Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

my @var1, @var2 not working #81

Closed
p6rt opened this issue May 8, 2008 · 7 comments
Closed

my @var1, @var2 not working #81

p6rt opened this issue May 8, 2008 · 7 comments

Comments

@p6rt
Copy link

p6rt commented May 8, 2008

Migrated from rt.perl.org#53902 (status was 'resolved')

Searchable as RT53902$

@p6rt
Copy link
Author

p6rt commented May 8, 2008

From @moritz

Rakudo as of r27393 can't handle multiple declarations in a single "my"​:

my (@​a, @​b); say @​a
Scope not found for PAST​::Var '@​a'
my @​a, @​b; say @​a
Scope not found for PAST​::Var '@​b'

Implementing that shouldn't be too hard, and would fix quite some of the
spec test failures.

Cheers,
Moritz

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented May 9, 2008

From @pmichaud

On Thu, May 08, 2008 at 11​:28​:36AM -0700, Moritz Lenz wrote​:

Rakudo as of r27393 can't handle multiple declarations in a single "my"​:

my (@​a, @​b); say @​a
Scope not found for PAST​::Var '@​a'

We'll work on this one.

my @​a, @​b; say @​a
Scope not found for PAST​::Var '@​b'

Rakudo has this one correct -- according to S03, scoping
multiple variables with 'my' requires the parens​:

: my $a; # okay
: my ($b, $c); # okay
: my ($b = 1, $c = 2); # okay - "my" intializers assign at runtime
: my $b, $c; # wrong​: "Use of undeclared variable​: $c"

Pm

@p6rt
Copy link
Author

p6rt commented May 9, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 10, 2008

From @nwc10

On Fri, May 09, 2008 at 06​:47​:12PM -0500, Patrick R. Michaud wrote​:

On Thu, May 08, 2008 at 11​:28​:36AM -0700, Moritz Lenz wrote​:

Rakudo as of r27393 can't handle multiple declarations in a single "my"​:

my (@​a, @​b); say @​a
Scope not found for PAST​::Var '@​a'

We'll work on this one.

my @​a, @​b; say @​a
Scope not found for PAST​::Var '@​b'

Rakudo has this one correct -- according to S03, scoping
multiple variables with 'my' requires the parens​:

: my $a; # okay
: my ($b, $c); # okay
: my ($b = 1, $c = 2); # okay - "my" intializers assign at runtime
: my $b, $c; # wrong​: "Use of undeclared variable​: $c"

But is that really the error message you want to be giving for that syntax
error? The double spaces suggest that something internal isn't even
interpolating as expected, due to a the string form of a name being missing.

Nicholas Clark

@p6rt
Copy link
Author

p6rt commented May 10, 2008

From @pmichaud

On Sat, May 10, 2008 at 09​:43​:38AM +0100, Nicholas Clark wrote​:

On Fri, May 09, 2008 at 06​:47​:12PM -0500, Patrick R. Michaud wrote​:

On Thu, May 08, 2008 at 11​:28​:36AM -0700, Moritz Lenz wrote​:

my @​a, @​b; say @​a
Scope not found for PAST​::Var '@​b'

Rakudo has this one correct -- according to S03, scoping
multiple variables with 'my' requires the parens​:

: my $a; # okay
: my ($b, $c); # okay
: my ($b = 1, $c = 2); # okay - "my" intializers assign at runtime
: my $b, $c; # wrong​: "Use of undeclared variable​: $c"

But is that really the error message you want to be giving for that syntax
error? The double spaces suggest that something internal isn't even
interpolating as expected, due to a the string form of a name being missing.

You're correct, the error message itself needs updating. At the moment
the error is being caught during code generation (in PCT), whereas
ideally we'd like to catch it during the parse (in the action
method). At that point we can give a better error message.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 16, 2008

From @moritz

As of 29505, 'my (@​var1, @​var2);' works, and 'my @​var1, @​var2;' gives
the proper "Scope not found for PAST​::Var '@​var2'" error message, so I'm
resolving this ticket.

@p6rt
Copy link
Author

p6rt commented Jul 16, 2008

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jul 16, 2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant