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

Rakudo wrongly permits mutation of readonly variables in some cases #408

Closed
p6rt opened this issue Nov 13, 2008 · 7 comments
Closed

Rakudo wrongly permits mutation of readonly variables in some cases #408

p6rt opened this issue Nov 13, 2008 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Nov 13, 2008

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

Searchable as RT60528$

@p6rt
Copy link
Author

p6rt commented Nov 13, 2008

From @masak

Rakudo r32629 sometimes dies when assigning a readonly variable to
itself, and sometimes not.

$ ./perl6 -e 'for <a b c> -> $foo { $foo = $foo; say $foo }' # dies, good
Cannot assign to readonly variable.
[...]

$ ./perl6 -e 'for split(/<sp>/, "a b c") -> $foo { $foo = $foo; say
$foo }' # baaaahd!
a
b
c

@p6rt
Copy link
Author

p6rt commented Nov 14, 2008

From @pmichaud

On Thu, Nov 13, 2008 at 03​:21​:45PM -0800, Carl Mäsak wrote​:

Rakudo r32629 sometimes dies when assigning a readonly variable to
itself, and sometimes not.

$ ./perl6 -e 'for <a b c> -> $foo { $foo = $foo; say $foo }' # dies, good
Cannot assign to readonly variable.
[...]

$ ./perl6 -e 'for split(/<sp>/, "a b c") -> $foo { $foo = $foo; say
$foo }' # baaaahd!
a
b
c

There's a bit more going on behind the scenes here -- the "$foo = $foo"
line in the second case is also promoting Parrot String values into
Rakudo Str objects. I suspect that promotion is causing the
readonly property on $foo to be lost.

My guess is that we want to adjust Parrot's C<copy> opcode so that
it doesn't modify the destination PMC's properties.

Thanks,

Pm

@p6rt
Copy link
Author

p6rt commented Nov 14, 2008

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

@p6rt
Copy link
Author

p6rt commented Nov 17, 2008

From @jnthn

On Fri Nov 14 05​:58​:21 2008, pmichaud wrote​:

On Thu, Nov 13, 2008 at 03​:21​:45PM -0800, Carl Mäsak wrote​:

Rakudo r32629 sometimes dies when assigning a readonly variable to
itself, and sometimes not.

$ ./perl6 -e 'for <a b c> -> $foo { $foo = $foo; say $foo }' # dies,
good
Cannot assign to readonly variable.
[...]

$ ./perl6 -e 'for split(/<sp>/, "a b c") -> $foo { $foo = $foo; say
$foo }' # baaaahd!
a
b
c

There's a bit more going on behind the scenes here -- the "$foo = $foo"
line in the second case is also promoting Parrot String values into
Rakudo Str objects. I suspect that promotion is causing the
readonly property on $foo to be lost.

My guess is that we want to adjust Parrot's C<copy> opcode so that
it doesn't modify the destination PMC's properties.

I've fixed it in a patch that's about to go in as soon as it smokes;
please can somebody make sure that a regression test goes in for this.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Nov 17, 2008

From @moritz

jnthn@​jnthn.net via RT wrote​:

I've fixed it in a patch that's about to go in as soon as it smokes;
please can somebody make sure that a regression test goes in for this.

test added in (pugs) r23032.

I hereby encourage all Rakudo hackers to give tickets to me if they have
fixed it, but there are no tests yet (with an appropriate comment, of
course). I can't promise to write tests for everything, but the chances
are much higher that way.

Cheers,
Moritz

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Nov 17, 2008

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

@p6rt p6rt closed this as completed Nov 17, 2008
@p6rt
Copy link
Author

p6rt commented Nov 17, 2008

From @pmichaud

On Mon, Nov 17, 2008 at 10​:15​:09PM +0100, Moritz Lenz wrote​:

I hereby encourage all Rakudo hackers to give tickets to me if they have
fixed it, but there are no tests yet (with an appropriate comment, of
course). I can't promise to write tests for everything, but the chances
are much higher that way.

I go further and make this standard policy​: We don't close a ticket
until there's a test. For now we'll assign "fixed but no test yet"
tickets to moritz.

It would be nice if the ticket also mentioned where the appropriate
test has been placed.

Pm

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