From: Christophe Grandsire Date: 2005-11-02T22:02:05+09:00 Subject: Re: ruby-dev summary 27393-27541 Selon Minero Aoki : > > There are still many arguments, for example: > > * whether "using" effects statically or dynamically > * '$' is ugly > * scope of "using" (file level / module level / method level) > * whether spaces are allowed around '$' > For the "'$' is ugly" argument, what about a syntax putting the namespace *after* the method name, and with an '@' in between (i.e. chop@jcode here)? It fits quite well with the "at" meaning that '@' has taken from things like e-mail And namespaces are different enough from classes and modules that I don't see why they should be put in front of method calls like those. And reading it becomes quite easy and fitting: class String def chop@jcode # "define chop at jcode" ... end end I'd think spaces should be disallowed around the '@' in that case, but it's just an aesthetic opinion. Also, how one would access the "namespaced" method using something like send, without using "using" first? I mean, "send(jcode$:chop)" just looks wrong, and "send(:jcode$chop)" doesn't look right either. Using my syntax, "send(:chop@jcode)" is a bit nicer (at least ":chop" stays together without clashes of symbols), but I'm still not sure I like it myself. Maybe a "send" with an optional second parameter for the namespace... By the way, are namespaces in their own namespace? (pardon the repetition) Anyway, just my two cents about this interesting feature. > > [ruby-dev:27470] def Foo::Bar.baz > > Shyouhei URABE claimed that "def Foo::Bar.baz" should be valid: > > ~ % ruby -ce 'def Foo::Bar.baz() end' > -e:1: syntax error, unexpected '.', expecting ';' or '\n' > def Foo::Bar.baz() end > ^ > -e:1: syntax error, unexpected kEND, expecting $end > > Matz rejected this claim because we cannot add this syntax without > any (yacc's) conflict. > First the block default arguments, now this... It's indeed time to get rid of yacc or patch it... Don't look at me! I can't do C :(( ... -- Christophe Grandsire. http://rainbow.conlang.free.fr It takes a straight mind to create a twisted conlang.