Leopold Toetsch wrote:
Am Donnerstag, 28. September 2006 21:42 schrieb Patrick R. Michaud:

    obj.'abc'()              # call 'abc' method of obj
    obj.abc()                # always the same as above
    obj.{abc}()              # call method indicated by abc symbol

This makes a lot of sense, and there are simple rules for the syntax:

* use {symbol}, if the thing isa symbol
* use 'name',  if the 'name' contains non-identifier characters
  (of if unsure, of if you are a compiler ;-)
* else you also might use bare word syntax

The latter two are the same rules as the rules for declaring methods/subs, which makes for nice consistency.

That should be it to deal with all that:

  obj.S0()     # emit warning but call 'S0' method

Rational: if bare <abc> isa identifier here, then C<S0> too.

I can see the value of this warning for the transition, but long-term we really don't want the code to be littered with warnings for deprecated features. It'd be pretty simple to write a script that combs the .pir files in the repository for any instance of a method name that looks like a register name.

  obj.$S0()    # illegal

Is '$' a valid identifier character? If so, then it's legal, but just treated as part of the string name of the method. If not (which seems more likely), then it's illegal anyway, so no special case is needed.

Allison

Reply via email to