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
Null PMC access when declarator with multiple variables contain sigilless in Rakudo #3064
Comments
From @masak<TimToady> nr: my ($x0, \x1) = (1, 2); say $x0; say x1 |
From @usev6The assignment to a sigilless in a () no longer results in a Null PMC access error -- but the sigilless doesn't contain the correct value after assignment: $ perl6-m -e 'my ($x0, \x1) = (1, 2); say $x0; say x1' $ perl6-m -e 'my (\x1) = 1; say x1' $ perl6-m -e 'my \x1 = 1; say x1' The behaves identical on Moar, Parrot and JVM. |
1 similar comment
From @usev6The assignment to a sigilless in a () no longer results in a Null PMC access error -- but the sigilless doesn't contain the correct value after assignment: $ perl6-m -e 'my ($x0, \x1) = (1, 2); say $x0; say x1' $ perl6-m -e 'my (\x1) = 1; say x1' $ perl6-m -e 'my \x1 = 1; say x1' The behaves identical on Moar, Parrot and JVM. |
@usev6 - Status changed from 'new' to 'open' |
From @usev6I added two tests (fudged 'todo') to S04-declarations/my.t with commit Raku/roast@c2c4f7cd48 |
1 similar comment
From @usev6I added two tests (fudged 'todo') to S04-declarations/my.t with commit Raku/roast@c2c4f7cd48 |
From @skidsFurther investigation of RT#117043. 1) It is specced (via STD and from there RT#116607 and from there $ perl6 -e 'my (\a);' # no error 2) Whether this principle carries over to sigilless parameters std: sub (\a?) { } 3) Sigilless variables in general are apparently supposed to $ perl6 -e 'my \a = 1; a = 2' 4) Precedence (?) for behavior when a bind does not happen but a $ perl6 -e 'my ($a, $b?) := 1,; $b.perl.say' 5) In any case if '=' means "bind" for sigilless variables, my ($a, \b) = 3,4; ... means that the signature has to be iterated and the operation Internally this: my (\x1) = 4; ...currently gets routed to a p6store: - QAST::Op(p6store) (\\x1) = 4 ...and so this probably unintended behavior is possible: $ perl6 -e 'my (\a) = 4; a.say; a = 5; a.say;' 6) The list-declarator construct also admits this: my (\c, \d) = @runtime-valued-array; ...which, if mandatory initialization is desired, must fail at |
From @masakBrian (>):
I expect the explanation is because sigilless variables (like constants) do not mutate after having been declared, and so it only makes sense to declare one if you also intend to assign to it. |
From @moritzOn Mon Mar 04 10:55:32 2013, masak wrote:
Works now, and the tests in my.t are passing. |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#117043 (status was 'resolved')
Searchable as RT117043$
The text was updated successfully, but these errors were encountered: