Agree with that, which is what I've used #as for too. Can the
(self, A)
syntax you suggest really work w/o problem? I fear it might go against
Matz's no look-ahead rule for the parser. Is that true? And if it is,
have you any other suggestion for it?
I don't know quite enough about the grammar to say if that syntax works
or not. I suspect that it isn't any more of a problem than the current
parallel assignment syntax:
(a,b) = :foo, :bar
The only thing different is the operator. But I really don't like that
syntax myself. My main point is that there are different sorts of
'dispatches'
you might want to have available and that the standard method syntax
probably
shouldn't be overloaded (e.g. Object#send) to access those different
types
of dispatches (for the same reasons that dot itself isn't a method based
operator)
recv.method arg1 # literal method
recv OP1 :name, arg1 # dynamic method
recv OP2 Klass, :name, arg1 # dynamic with modified method lookup
I'm not sure what OP1 or OP2 might be that would look reasonable,
have some
sort of reasonable mnemonic, and also not screw up the grammar. Maybe:
recv.method(arg1) # literal method
recv.*
method, arg1) # dynamic (mnemonic: * is a wild card?)
recv.**(Klass, :method, arg1) # dynamic with modified lookup
recv.*!
method, arg1) # private also
recv.**!(Klass, :method, arg1) # modified and private
I think different types of dispatch operators would end up having
clearer
semantics than 'magic' methods (like BasicObject#send). I don't have
any
great ideas about the actual syntax though. I don't like the
Pervasive class
idea (nor the name itself even if the idea were to catch on).
Gary Wright