Clear questions and runnable code
get the best and fastest answer
Perl6: S2 identifier and $ special var questionsby rir (Vicar)
|on Sep 14, 2011 at 15:26 UTC||Need Help??|
rir has asked for the
wisdom of the Perl Monks concerning the following question:
Quoting Synopsis 2:
The $Package'var syntax is gone. Use $Package::var instead. (Note, however, that identifiers may now contain an apostrophe or hyphen if followed by an "idfirst" letter.)idfirst means a unicode Alpha character (roughly equivalent to \w) and it seems that the Synopsis may be revised.
So this seems to allow these kind of declarations:
In Rakudo Perl 6, version 2011.07 this doesn't work. Rakudo seems to accept any text, including an empty string, and these all declare the same $ and a second declarations give a diagnostic like:
(Re: the spec):
Do I have the quotish syntax correct? Is there test code at which to look?
Is this meant to apply to my identifiers? Subroutine and method identfiers?
What is the rationale for this flexibility in identifiers? I can see how language design/evolution and interfacing with other languages may be enhanced, but I wonder if I am missing some intended utility.
Is there supposed to be a $ variable in any context?