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

No runtime warning when list-assigning to readonly things in Rakudo #1736

Closed
p6rt opened this issue May 1, 2010 · 8 comments
Closed

No runtime warning when list-assigning to readonly things in Rakudo #1736

p6rt opened this issue May 1, 2010 · 8 comments

Comments

@p6rt
Copy link

p6rt commented May 1, 2010

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

Searchable as RT74820$

@p6rt
Copy link
Author

p6rt commented May 1, 2010

From @masak

<moritz_> rakudo​: sub swap($a is rw, $b is rw) { ($a, $b) = ($b, $a)
}; swap(3, 4) # should that die?
<p6eval> rakudo c4857a​: ( no output )
<moritz_> I'm quite sure it should :/
<masak> aye, me too.
* moritz_ predicts masak's next line
* masak does the thing that fulfills that prediction
<masak> rakudo​: sub foo($a is rw) { $a = 5 }; foo(42)
<p6eval> rakudo c4857a​: OUTPUT«Cannot assign to readonly value
<masak> rakudo​: (1, 2) = 3, 4
<p6eval> rakudo c4857a​: ( no output )
<masak> ok, so it's the list assignment that doesn't pick up on non-rw values.

@p6rt
Copy link
Author

p6rt commented May 3, 2010

From @markjreed

Huh? Those are explicitly read-write. Why is it dying at all?

On Sat, May 1, 2010 at 9​:17 AM, Carl Mäsak <perl6-bugs-followup@​perl.org>wrote​:

# New Ticket Created by "Carl Mäsak"
# Please include the string​: [perl #​74820]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=74820 >

<moritz_> rakudo​: sub swap($a is rw, $b is rw) { ($a, $b) = ($b, $a)
}; swap(3, 4) # should that die?
<p6eval> rakudo c4857a​: ( no output )
<moritz_> I'm quite sure it should :/
<masak> aye, me too.
* moritz_ predicts masak's next line
* masak does the thing that fulfills that prediction
<masak> rakudo​: sub foo($a is rw) { $a = 5 }; foo(42)
<p6eval> rakudo c4857a​: OUTPUT«Cannot assign to readonly value
<masak> rakudo​: (1, 2) = 3, 4
<p6eval> rakudo c4857a​: ( no output )
<masak> ok, so it's the list assignment that doesn't pick up on non-rw
values.

--
Mark J. Reed <markjreed@​gmail.com>

@p6rt
Copy link
Author

p6rt commented May 3, 2010

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

@p6rt
Copy link
Author

p6rt commented May 3, 2010

From @masak

Carl (>>), Mark (>)​:

<moritz_> rakudo​: sub swap($a is rw, $b is rw) { ($a, $b) = ($b, $a)
}; swap(3, 4) # should that die?

Huh? Those are explicitly read-write. Why is it dying at all?

We're passing in 3 and 4, which are constants. The parameters $a and $b are indeed marked as
rw, but they're bound directly to immutable values, so Rakudo should die at runtime because
you can't change 3 and 4.

@p6rt
Copy link
Author

p6rt commented May 3, 2010

From @moritz

Am 03.05.2010 12​:30, schrieb Mark J. Reed​:

Huh? Those are explicitly read-write. Why is it dying at all?

Yes. I think masak++ picked up the wrong lines from p6eval​:

<@​moritz_> rakudo​: sub swap($a, $b) { ($a, $b) = ($b, $a) }; swap my $z
= 2, my $y = 5;
<+p6eval> rakudo c4857a​: ( no output )

*this* should die.

On Sat, May 1, 2010 at 9​:17 AM, Carl Mäsak<perl6-bugs-followup@​perl.org>wrote​:

# New Ticket Created by "Carl Mäsak"
# Please include the string​: [perl #​74820]
# in the subject line of all future correspondence about this issue.
#<URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=74820>

<moritz_> rakudo​: sub swap($a is rw, $b is rw) { ($a, $b) = ($b, $a)
}; swap(3, 4) # should that die?
<p6eval> rakudo c4857a​: ( no output )
<moritz_> I'm quite sure it should :/
<masak> aye, me too.
* moritz_ predicts masak's next line
* masak does the thing that fulfills that prediction
<masak> rakudo​: sub foo($a is rw) { $a = 5 }; foo(42)
<p6eval> rakudo c4857a​: OUTPUT«Cannot assign to readonly value
<masak> rakudo​: (1, 2) = 3, 4
<p6eval> rakudo c4857a​: ( no output )
<masak> ok, so it's the list assignment that doesn't pick up on non-rw
values.

@p6rt
Copy link
Author

p6rt commented Sep 20, 2011

From @coke

On Mon May 03 04​:20​:44 2010, moritz wrote​:

Am 03.05.2010 12​:30, schrieb Mark J. Reed​:

Huh? Those are explicitly read-write. Why is it dying at all?

Yes. I think masak++ picked up the wrong lines from p6eval​:

<@​moritz_> rakudo​: sub swap($a, $b) { ($a, $b) = ($b, $a) }; swap my
$z
= 2, my $y = 5;
<+p6eval> rakudo c4857a​: ( no output )

*this* should die.

On Sat, May 1, 2010 at 9​:17 AM, Carl M�sak<perl6-bugs-
followup@​perl.org>wrote​:

# New Ticket Created by "Carl M�sak"
# Please include the string​: [perl #​74820]
# in the subject line of all future correspondence about this
issue.
#<URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=74820>

<moritz_> rakudo​: sub swap($a is rw, $b is rw) { ($a, $b) = ($b,
$a)
}; swap(3, 4) # should that die?
<p6eval> rakudo c4857a​: ( no output )
<moritz_> I'm quite sure it should :/
<masak> aye, me too.
* moritz_ predicts masak's next line
* masak does the thing that fulfills that prediction
<masak> rakudo​: sub foo($a is rw) { $a = 5 }; foo(42)
<p6eval> rakudo c4857a​: OUTPUT�Cannot assign to readonly value
<masak> rakudo​: (1, 2) = 3, 4
<p6eval> rakudo c4857a​: ( no output )
<masak> ok, so it's the list assignment that doesn't pick up on
non-rw
values.

And now it does​:

$ ./perl6 foo -e 'sub swap($a, $b) { ($a, $b) = ($b, $a) }; swap my $z = 2, my $y = 5;'
Cannot assign to a readonly variable or a value
  in method STORE at src/gen/CORE.setting​:3369
  in sub swap at foo​:1
  in sub swap at foo​:1
  in <anon> at foo​:1
  in <anon> at foo​:1

tests needed.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 30, 2011

From @moritz

Now tested in t/spec/S06-traits/is-rw.t.

@p6rt
Copy link
Author

p6rt commented Sep 30, 2011

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant