Am Donnerstag, 28. September 2006 22:53 schrieb Allison Randal: > 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.
Yep. > > 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. Indeed. I'm pretty sure that there isn't one test nor other .pir in the tree using this syntax. The rules are clear enough: C<S0> is parsed as IDentifier in that case, which means: obj.S0() := obj.'S0'() That is: no warning needed at all. > > obj.$S0() # illegal > > Is '$' a valid identifier character? No. Just a PIR temp variable signature, which makes the thingy a variable or synmbol. > 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. I wanted just to stress the illegality of it as it was differently used in a previous mail. > Allison leo