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

Type object seem to bind in item or push #3418

Closed
p6rt opened this issue Jun 19, 2014 · 6 comments
Closed

Type object seem to bind in item or push #3418

p6rt opened this issue Jun 19, 2014 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jun 19, 2014

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

Searchable as RT122137$

@p6rt
Copy link
Author

p6rt commented Jun 19, 2014

From @lizmat

[19​:00​:36] <lizmat> r​: my @​a; my $c = Int; @​a.push​: $($c,1); $c=Str; @​a.push​: $($c,2); say @​a.perl
[19​:00​:41] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«Array.new($(Str, 1), $(Str, 2))␤»
[19​:02​:35] <lizmat> feels like the push binds to the variable, rather than just copy ?
[19​:02​:45] <lizmat> am I missing something?
[19​:04​:02] <Mouq> r​: my @​a; my $c = Int; @​a.push​: item Array.new($c,1); $c=Str; say @​a.perl
[19​:04​:06] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«Array.new([Int, 1])␤»
[19​:13​:38] <lizmat> n​: my @​a; my $c = Int; @​a.push​: $($c,1); $c=Str; @​a.push​: $($c,2); say @​a.perl
[19​:13​:40] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«[$(Str, 1), $(Str, 2)].list␤»
[19​:16​:15] <lizmat> m​: my @​a; my $c = Int; @​a.push​: $($c,1); $c=Str; @​a.push​: $($c,2); say @​a.perl
[19​:16​:16] <+camelia> rakudo-moar 8812ca​: OUTPUT«Array.new($(Str, 1), $(Str, 2))␤»
[19​:16​:21] <lizmat> I would expect to see​:
[19​:16​:35] <lizmat> Array.new($(Int, 1), $(Str, 2))
[19​:17​:05] <lizmat> am I wrong? Is there something about type objects that make them bind in a .push?
[19​:23​:24] lizmat submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jun 20, 2014

From @lizmat

Additional finds​:

[19​:24​:52] <timotimo> m​: my @​a; my $c = 1; @​a.push​: $($c,1); $c = "hi"; @​a.push​: $($c,2); say @​a.perl
[19​:24​:53] <+camelia> rakudo-moar 8812ca​: OUTPUT«Array.new($("hi", 1), $("hi", 2))␤»
[19​:25​:09] <timotimo> it would appear the container of the $c is being pushed, rather than the value?
[19​:26​:56] <Mouq> It's not the fact that it's being pushed, it's the building of $($c, 1), isn't it?
[19​:27​:14] <timotimo> could very well be
[19​:27​:19] <timotimo> is that being done at compile-time perhaps?
[19​:27​:29] <Mouq> m​: my $c = 1; my \b = $($c, 1); $c = Int; say b.perl
[19​:27​:31] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:27​:39] <Mouq> m​: my $c = 1; my $b = $($c, 1); $c = Int; say $b.perl
[19​:27​:40] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:28​:22] <timotimo> no, the optimizer leaves that alone.
[19​:29​:22] <Mouq> m​: my $c = 1; my $b = ($c, 1); $c = Int; say $b.perl
[19​:29​:23] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:29​:30] <Mouq> m​: my $c = 1; my $b = [$c, 1]; $c = Int; say $b.perl
[19​:29​:31] <+camelia> rakudo-moar 8812ca​: OUTPUT«[1, 1]␤»
[19​:30​:37] <Mouq> m​: my $c = 1; my $b = Array.new($c, 1); $c = Int; say $b.perl
[19​:30​:38] <+camelia> rakudo-moar 8812ca​: OUTPUT«[Int, 1]␤»
[19​:30​:44] <Mouq> Many WTFs to be had
[19​:31​:33] <Mouq> p6​: my $c = 1; my $b = Array.new($c, 1); $c = Int; say $b.perl
[19​:31​:38] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«Unhandled exception​: Excess arguments to List.new, used 1 of 3 positionals␤ at /home/p6eval/niecza/lib/CORE.setting line 0 (List.new @​ 1) ␤ at /tmp/tmpfile line 1 (mainline @​ 4) ␤ at /home/p6eval/niecza/lib/CORE.setting line 4595 (ANON @​ 3) …»
[19​:31​:38] <+camelia> ..rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«[Int, 1]␤»
[19​:31​:51] <Mouq> n​: my $c = 1; my $b = ($c, 1); $c = Int; say $b.perl
[19​:31​:53] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«$(Int, 1)␤»
[19​:33​:07] <Mouq> OTOH, ($c,) having the container is the only way ($c, *) = * could work
[19​:33​:21] <Mouq> Other than special-casing
[19​:34​:32] <timotimo> that's true
[19​:35​:03] <timotimo> m​: my $c; say $($c, 1).WHAT
[19​:35​:03] <+camelia> rakudo-moar 8812ca​: OUTPUT«(Parcel)␤»
[19​:35​:07] <timotimo> ah, it's a parcel
[19​:35​:18] <timotimo> those are supposed to be internal-ish magic-ish any way
[19​:35​:36] <timotimo> to be honest, i'd rather use [ ] for nested structures
[20​:39​:20] <lizmat> Mouq​: it has nothing to do with .push (or unshift)​: it has to do with Parcel generation​:
[20​:39​:23] <lizmat> r​: my $c=42; my $a = $($c,1); $c=43; my $b = $($c,2); .perl.say for $a, $b
[20​:39​:27] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(43, 1)␤$(43, 2)␤»
[20​:40​:03] <lizmat> r​: my $c=42; my $a = $(+$c,1); $c=43; my $b = $(+$c,2); .perl.say for $a, $b
[20​:40​:06] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(42, 1)␤$(43, 2)␤»
[20​:40​:20] <lizmat> r​: my $c=42; my $a = $($c,1); $c=43; my $b = $(+$c,2); .perl.say for $a, $b
[20​:40​:24] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(43, 1)␤$(43, 2)␤»
[20​:40​:39] <lizmat> r​: my $c=42; my $a = $(+$c,1); $c=43; my $b = $($c,2); .perl.say for $a, $b
[20​:40​:43] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(42, 1)␤$(43, 2)␤»
[20​:42​:36] <lizmat> ah, timotimo and Mouq already established that :-)

@p6rt
Copy link
Author

p6rt commented Sep 18, 2017

From @skids

On Thu, 19 Jun 2014 17​:45​:23 -0700, elizabeth wrote​:

Additional finds​:

[19​:24​:52] <timotimo> m​: my @​a; my $c = 1; @​a.push​: $($c,1); $c =
"hi"; @​a.push​: $($c,2); say @​a.perl
[19​:24​:53] <+camelia> rakudo-moar 8812ca​: OUTPUT«Array.new($("hi",
1), $("hi", 2))␤»
[19​:25​:09] <timotimo> it would appear the container of the $c is
being pushed, rather than the value?
[19​:26​:56] <Mouq> It's not the fact that it's being pushed,
it's the building of $($c, 1), isn't it?
[19​:27​:14] <timotimo> could very well be
[19​:27​:19] <timotimo> is that being done at compile-time perhaps?
[19​:27​:29] <Mouq> m​: my $c = 1; my \b = $($c, 1); $c = Int; say
b.perl
[19​:27​:31] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:27​:39] <Mouq> m​: my $c = 1; my $b = $($c, 1); $c = Int; say
$b.perl
[19​:27​:40] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:28​:22] <timotimo> no, the optimizer leaves that alone.
[19​:29​:22] <Mouq> m​: my $c = 1; my $b = ($c, 1); $c = Int; say
$b.perl
[19​:29​:23] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:29​:30] <Mouq> m​: my $c = 1; my $b = [$c, 1]; $c = Int; say
$b.perl
[19​:29​:31] <+camelia> rakudo-moar 8812ca​: OUTPUT«[1, 1]␤»
[19​:30​:37] <Mouq> m​: my $c = 1; my $b = Array.new($c, 1); $c =
Int; say $b.perl
[19​:30​:38] <+camelia> rakudo-moar 8812ca​: OUTPUT«[Int, 1]␤»
[19​:30​:44] <Mouq> Many WTFs to be had
[19​:31​:33] <Mouq> p6​: my $c = 1; my $b = Array.new($c, 1); $c =
Int; say $b.perl
[19​:31​:38] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«Unhandled
exception​: Excess arguments to List.new, used 1 of 3 positionals␤ at
/home/p6eval/niecza/lib/CORE.setting line 0 (List.new @​ 1) ␤ at
/tmp/tmpfile line 1 (mainline @​ 4) ␤ at
/home/p6eval/niecza/lib/CORE.setting line 4595 (ANON @​ 3) …»
[19​:31​:38] <+camelia> ..rakudo-{parrot,jvm,moar} 8812ca​:
OUTPUT«[Int, 1]␤»
[19​:31​:51] <Mouq> n​: my $c = 1; my $b = ($c, 1); $c = Int; say
$b.perl
[19​:31​:53] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«$(Int, 1)␤»
[19​:33​:07] <Mouq> OTOH, ($c,) having the container is the only
way ($c, *) = * could work
[19​:33​:21] <Mouq> Other than special-casing
[19​:34​:32] <timotimo> that's true
[19​:35​:03] <timotimo> m​: my $c; say $($c, 1).WHAT
[19​:35​:03] <+camelia> rakudo-moar 8812ca​: OUTPUT«(Parcel)␤»
[19​:35​:07] <timotimo> ah, it's a parcel
[19​:35​:18] <timotimo> those are supposed to be internal-ish magic-
ish any way
[19​:35​:36] <timotimo> to be honest, i'd rather use [ ] for nested
structures
[20​:39​:20] <lizmat> Mouq​: it has nothing to do with .push (or
unshift)​: it has to do with Parcel generation​:
[20​:39​:23] <lizmat> r​: my $c=42; my $a = $($c,1); $c=43; my $b =
$($c,2); .perl.say for $a, $b
[20​:39​:27] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(43,
1)␤$(43, 2)␤»
[20​:40​:03] <lizmat> r​: my $c=42; my $a = $(+$c,1); $c=43; my $b =
$(+$c,2); .perl.say for $a, $b
[20​:40​:06] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(42,
1)␤$(43, 2)␤»
[20​:40​:20] <lizmat> r​: my $c=42; my $a = $($c,1); $c=43; my $b =
$(+$c,2); .perl.say for $a, $b
[20​:40​:24] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(43,
1)␤$(43, 2)␤»
[20​:40​:39] <lizmat> r​: my $c=42; my $a = $(+$c,1); $c=43; my $b =
$($c,2); .perl.say for $a, $b
[20​:40​:43] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(42,
1)␤$(43, 2)␤»
[20​:42​:36] <lizmat> ah, timotimo and Mouq already established
that :-)

I don't see anything that looks out of sorts with our current
post-GLR semantics. Should this (very old) ticket just be retired now?

@p6rt
Copy link
Author

p6rt commented Sep 18, 2017

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

@p6rt
Copy link
Author

p6rt commented Mar 12, 2018

From @dogbert17

On Mon, 18 Sep 2017 13​:52​:21 -0700, bri@​abrij.org wrote​:

On Thu, 19 Jun 2014 17​:45​:23 -0700, elizabeth wrote​:

Additional finds​:

[19​:24​:52] <timotimo> m​: my @​a; my $c = 1; @​a.push​: $($c,1); $c =
"hi"; @​a.push​: $($c,2); say @​a.perl
[19​:24​:53] <+camelia> rakudo-moar 8812ca​: OUTPUT«Array.new($("hi",
1), $("hi", 2))␤»
[19​:25​:09] <timotimo> it would appear the container of the $c is
being pushed, rather than the value?
[19​:26​:56] <Mouq> It's not the fact that it's being pushed,
it's the building of $($c, 1), isn't it?
[19​:27​:14] <timotimo> could very well be
[19​:27​:19] <timotimo> is that being done at compile-time perhaps?
[19​:27​:29] <Mouq> m​: my $c = 1; my \b = $($c, 1); $c = Int; say
b.perl
[19​:27​:31] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:27​:39] <Mouq> m​: my $c = 1; my $b = $($c, 1); $c = Int; say
$b.perl
[19​:27​:40] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:28​:22] <timotimo> no, the optimizer leaves that alone.
[19​:29​:22] <Mouq> m​: my $c = 1; my $b = ($c, 1); $c = Int; say
$b.perl
[19​:29​:23] <+camelia> rakudo-moar 8812ca​: OUTPUT«$(Int, 1)␤»
[19​:29​:30] <Mouq> m​: my $c = 1; my $b = [$c, 1]; $c = Int; say
$b.perl
[19​:29​:31] <+camelia> rakudo-moar 8812ca​: OUTPUT«[1, 1]␤»
[19​:30​:37] <Mouq> m​: my $c = 1; my $b = Array.new($c, 1); $c =
Int; say $b.perl
[19​:30​:38] <+camelia> rakudo-moar 8812ca​: OUTPUT«[Int, 1]␤»
[19​:30​:44] <Mouq> Many WTFs to be had
[19​:31​:33] <Mouq> p6​: my $c = 1; my $b = Array.new($c, 1); $c =
Int; say $b.perl
[19​:31​:38] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«Unhandled
exception​: Excess arguments to List.new, used 1 of 3 positionals␤ at
/home/p6eval/niecza/lib/CORE.setting line 0 (List.new @​ 1) ␤ at
/tmp/tmpfile line 1 (mainline @​ 4) ␤ at
/home/p6eval/niecza/lib/CORE.setting line 4595 (ANON @​ 3) …»
[19​:31​:38] <+camelia> ..rakudo-{parrot,jvm,moar} 8812ca​:
OUTPUT«[Int, 1]␤»
[19​:31​:51] <Mouq> n​: my $c = 1; my $b = ($c, 1); $c = Int; say
$b.perl
[19​:31​:53] <+camelia> niecza v24-109-g48a8de3​: OUTPUT«$(Int, 1)␤»
[19​:33​:07] <Mouq> OTOH, ($c,) having the container is the only
way ($c, *) = * could work
[19​:33​:21] <Mouq> Other than special-casing
[19​:34​:32] <timotimo> that's true
[19​:35​:03] <timotimo> m​: my $c; say $($c, 1).WHAT
[19​:35​:03] <+camelia> rakudo-moar 8812ca​: OUTPUT«(Parcel)␤»
[19​:35​:07] <timotimo> ah, it's a parcel
[19​:35​:18] <timotimo> those are supposed to be internal-ish magic-
ish any way
[19​:35​:36] <timotimo> to be honest, i'd rather use [ ] for nested
structures
[20​:39​:20] <lizmat> Mouq​: it has nothing to do with .push (or
unshift)​: it has to do with Parcel generation​:
[20​:39​:23] <lizmat> r​: my $c=42; my $a = $($c,1); $c=43; my $b =
$($c,2); .perl.say for $a, $b
[20​:39​:27] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(43,
1)␤$(43, 2)␤»
[20​:40​:03] <lizmat> r​: my $c=42; my $a = $(+$c,1); $c=43; my $b =
$(+$c,2); .perl.say for $a, $b
[20​:40​:06] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(42,
1)␤$(43, 2)␤»
[20​:40​:20] <lizmat> r​: my $c=42; my $a = $($c,1); $c=43; my $b =
$(+$c,2); .perl.say for $a, $b
[20​:40​:24] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(43,
1)␤$(43, 2)␤»
[20​:40​:39] <lizmat> r​: my $c=42; my $a = $(+$c,1); $c=43; my $b =
$($c,2); .perl.say for $a, $b
[20​:40​:43] <+camelia> rakudo-{parrot,jvm,moar} 8812ca​: OUTPUT«$(42,
1)␤$(43, 2)␤»
[20​:42​:36] <lizmat> ah, timotimo and Mouq already established
that :-)

I don't see anything that looks out of sorts with our current
post-GLR semantics. Should this (very old) ticket just be retired now?

Very old bug. Closed after discussion with lizmat, see
https://irclog.perlgeek.de/perl6-dev/2018-03-12#i_15911761

@p6rt
Copy link
Author

p6rt commented Mar 12, 2018

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

@p6rt p6rt closed this as completed Mar 12, 2018
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