From: Eero Saynatkari Date: 2005-11-05T17:31:10+09:00 Subject: Re: ruby-dev summary 27393-27541 Trans wrote: > In the past I always thought of ':' (boy that comes up a lot ;-) > > p "\244\242\244\244".jcode:chop Yes, this is usually the syntax I prefer to illustrate selector namespaces. They would also (visually) benefit from being constants (i.e. uppercase rather than lowercase). However, it seems that the name 'selector namespace' is a bit inaccurate for the current implementation as it concentrates much more on the 'namespace' than the 'selector' which is unfortunate. I would much rather see this: module NS def foo puts 'NS' + @foo end end class Foo def initialize @foo = 'foo' end def foo puts 'Foo' + @foo end end f = Foo.new puts f.foo # Foofoo puts f.NS:foo # NSfoo Here there is no concrete namespace but rather a namespace is dynamically created to facilitate selecting the implementation. Again, this is perhaps more AOP-like than some would prefer and perhaps this is missing some benefits of the other approach. E.face[:cheek] = :tongue p "\244\242\244\244".JCode-chop p "\244\242\244\244".chop~JCode p "\244\242\244\244".jcode->chop p "\244\242\244\244".JCode#chop > But I'm wondering if two colons could work, > > p "\244\242\244\244".jcode::chop > > because a namespace is much like a module. Also maybe > > p "\244\242\244\244".(jcode)chop > > By the way Facets can already do some stuff like this via: > > module JCode > def chop > ... > end > end > > class String > include JCode > end > > "\244\242\244\244".as(JCode).chop > > Yep. If you guessed Functor, you are right. > > T. E