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:my $<-var>; our $<-v'a-r>; # line 76
> ===SORRY!=== > Redeclaration of symbol $ at line 76, near " = \"B\"; sa"
(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?
Be well,
rir
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl6: S2 identifier and $ special var questions
by TimToady (Parson) on Sep 14, 2011 at 16:56 UTC | |
by moritz (Cardinal) on Sep 14, 2011 at 18:06 UTC | |
Re: Perl6: S2 identifier and $ special var questions
by PrakashK (Pilgrim) on Sep 14, 2011 at 15:56 UTC | |
by rir (Vicar) on Sep 14, 2011 at 17:26 UTC | |
by TimToady (Parson) on Sep 14, 2011 at 18:19 UTC |
Back to
Seekers of Perl Wisdom