gwtm... / mac.com wrote: > 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) And I agree. And I think the syntax you have suggested is pretty close. > recv.method arg1 # literal method > recv OP1 :name, arg1 # dynamic method > recv OP2 Klass, :name, arg1 # dynamic with modified method lookup Hmm... because the method will always be a string or symbol, a class or module could be distinguished, so looking at your template I now see that it's possible for OP1 == OP2: obj -> Base, :name, *args And I wonder if the Base form could grant access to private space too? The Base form is pretty meta-hackery in itself so I think that would be okay. Then we would't need an "OP3" for private access. Just do: obj -> (obj ~> :class), :name, *args where ~> is pervasive send. > 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). I know the mnemonic isn't great, but '->' really is common as a dispatch op. Anyone who's done their share of Perl or PHP coding is going to feel right at home with it. And I think the rest of us can grow accustomed. So maybe give it a chance? B/c if so, I think this is looking pretty damn nice! T.