Trans wrote: > I've been thinking about the last thread on module methods and > namespaces, and also the idea of method modifiers. There are times when > I just want one method that does a number of different but related > things. Th obligatory silly example, > > class T > def dothis(sym, *args) > when :oneway > puts "One Way! #{args}" > when :another > puts "Another! #{args}" > end > end > end > > t = T.new > t.dothis :oneway > > But we can also do this without the space, > > t.dothis:another I think this in itself is pretty nice. > IMO that's nice. And allows me to get the effect that I want. What > would be even more convenient thgouh is if this later form, lacking the > space, would give the method precedence, so we could do, > > t.dothis:another.upcase > > and it would work, executing #dothis before #upcase. Then, also, > secondary parameters could be given without the initial comma. So, > > t.dothis :oneway, 1 > > could instead be written, > > t.dothis:oneway 1 Musing on this, you know what'd be really great? Support for partial function application! I suppose this could already be emulated (or, more aptly, evamulated), but it could be a really useful feature. Those pesky side-effects just get in the way but I'm sure that could be overcome :) > I do not think this would present any ambiguity to the parser. In fact > I thnk it can be take to any number of initial symbols. > > t.dothis:oneway:twoway:threeway > Where each subsequent symbol is another argument. > > T E