Selon Kero :
It's too close to:
p "\244\242\244\244".chop @jcode
That's an ArgumentError, but it would be a valid call to chomp, for instance.
holds as well for
jcode $chop
jcode :chop
chop :jcode
and probably some other ideas in this thread.
Exactly. I wanted to reply that but you beat me to it
. If matz and others find it good enough to implement jcode$chop, alternatives should be as good enough
.
I recall someone asking whther namespaces would be 'different' from
methods, i.e. if there is also a *method* jcode in the example above,
the space is really wreaking havoc.
That was me again
. I had also already thought of that problem, which is why I said that there shouldn't be any space allowed between the method and the namespace using such a syntax. Namespaces, when used directly with a method, should indeed be considered *part* of the name of that method. And since we don't have methods which allow a space in their name (short maybe of using exotic method definitions with define_method, and even then I don't know if it's possible), I don't think we should allow it if we add namespaces to them.
I agree on the other hand that the "using" suffix idea solves the problem neatly, except that it breaks havoc with method chaining.
Anyway, it's not as if Ruby's philosophy is "there's only one way to do it"
. I don't see why we couldn't have a $, :, @ or whatever syntax *and* a "using" suffix (or prefix?), although with the "using", to prevent unsolvable issues about how two "using"s might work with each other in case of method chaining, we would restrict to 1 "using". If you need to chain methods from different namespaces, use the $, @, : or whatever syntax.
On the subject of "using", what should happen if we call a method in the scope of a "using" (whether it is "using namespace", "using namespace {...}, or "obj.method using namespace") that is *not* redefined in that namespace. Should we get an error, a warning, or should the original method from that object simply be called without any warning. I'm personally leaning toward a warning, and let the original method of the object be used. Maybe the warning should be there only in verbose output... I'm curious what others think about that.
···
--
Christophe Grandsire.
http://rainbow.conlang.free.fr
You need a straight mind to invent a twisted conlang.