Hi -- On Sun, 19 Jan 2003, ahoward wrote: > On Sat, 18 Jan 2003 dblack / candle.superlink.net wrote: > > > Well, "random" is a bit extreme... :-) My main focus in all of this > > is to explore ways of making it easier and faster to do something > > which I think is very natural for Ruby, namely to handle situations > > based on the capabilities and responses of the objects present at > > a given point. > > > > In particular, I think part of the difficulty in trying to convince > > people not to rely on explicit type-checking in Ruby is that there's > > no really compelling, precise alternative. The double-barreled > > "respond_to?"/method-call is, well, double-barreled, and the exception > > wrapper is slow and inexact. > > it seems like what you are after then are dynamic interfaces, after all > wouldn't > > if object.implements? interface > ... > # does it implement all of an interface > > or even > > if objects.implements? interface.method :sym > ... > # does it implement a method from this interface, eg with same args, etc. > > if they existed, would solve all of this. it's true this is not the same as > NACK but you wouldn't need NACK if one could tell if an object implemented > some sort of interface would you? checking if and object did implement and > interface wouldn't really be that different from respond_to? but it would > consoldate it considerably and result in quite readable, brief code i think. I guess, though to me conceptually and practically a NACK implementation is a smaller, more incremental step from what I do already in Ruby -- really almost just cosmetic, just the same kind and degree of information we have now, but handed over in a slightly different order. I think a whole interface apparatus is probably another order of magnitude of programming style and/or language adjustment. David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav