Skip Menu |

Subject: [BUG] Either binding an array to a list containing the array itself should work consistently or not at all in Rakudo
Date: Fri, 25 Mar 2011 22:00:13 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 759b
<masak> rakudo: my @foo := 1..3, @foo; .say for @foo[^10] <p6eval> rakudo 792e86: OUTPUT«1␤2␤3␤1␤2␤3␤1␤2␤3␤1␤» <masak> this is what I expect. <pmurias> sorear: explain what you mean by the second thing? <masak> rakudo: my @foo := 1..3, (@foo Z+ 100); .say for @foo[^10] <p6eval> rakudo 792e86: OUTPUT«1␤2␤3␤101␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤» <masak> that... is not. <masak> can we rely on array binding of the above kind to work? <masak> if yes, is the second eval an expression of a rakudobug? <masak> if no, how are we supposed to explain that some cases work and some not? :/ <sorear> masak: I beleive so on both counts * masak submits rakudobug <sorear> I expect "1 2 3 Any() Any() ..." for both of them
RT-Send-CC: perl6-compiler [...] perl.org
On Fri Mar 25 14:00:30 2011, masak wrote: Show quoted text
> <masak> rakudo: my @foo := 1..3, @foo; .say for @foo[^10] > <p6eval> rakudo 792e86: OUTPUT«1␤2␤3␤1␤2␤3␤1␤2␤3␤1␤» > <masak> this is what I expect. > <pmurias> sorear: explain what you mean by the second thing? > <masak> rakudo: my @foo := 1..3, (@foo Z+ 100); .say for @foo[^10] > <p6eval> rakudo 792e86: > OUTPUT«1␤2␤3␤101␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤» > <masak> that... is not. > <masak> can we rely on array binding of the above kind to work? > <masak> if yes, is the second eval an expression of a rakudobug? > <masak> if no, how are we supposed to explain that some cases work and > some not? :/ > <sorear> masak: I beleive so on both counts > * masak submits rakudobug > <sorear> I expect "1 2 3 Any() Any() ..." for both of them
<sorear> masak: ignore everything I've said in the last 12 minutes; I misread your example as my @foo := 1..3; @foo; .say for @foo[^10] <masak> ah :) <sorear> and I was WTFing at the rakudoinsanity * masak adds that to the rakudobug
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 717b
<sorear> eagerly (without {} blocks) self-referential binding will never work <sorear> because all occurrences of @fib in the RHS will be resolved to the old container, which is discarded by the binding <sorear> eagerly self-referential *assignment* may work in some cases <masak> rakudo: my @selfref := 1, 2, 3, @selfref; .say for @selfref[^10] <p6eval> rakudo 792e86: OUTPUT«1␤2␤3␤1␤2␤3␤1␤2␤3␤1␤» <masak> sorear: how come that works, then? <sorear> masak: rakudo's broken binding model <masak> :( <sorear> perl6: my $x = 1; my $y := $x; $x := 3; say $y; <p6eval> pugs, niecza v3-82-g1dc43eb: OUTPUT«1␤» <p6eval> ..rakudo 792e86: OUTPUT«3␤» <masak> that is indeed broken. <masak> wow.
Download (untitled) / with headers
text/plain 491b
On Fri Mar 25 14:48:47 2011, masak wrote: Show quoted text
> <masak> sorear: how come that works, then? > <sorear> masak: rakudo's broken binding model > <masak> :( > <sorear> perl6: my $x = 1; my $y := $x; $x := 3; say $y; > <p6eval> pugs, niecza v3-82-g1dc43eb: OUTPUT«1␤» > <p6eval> ..rakudo 792e86: OUTPUT«3␤» > <masak> that is indeed broken. > <masak> wow.
That one is fixed now, and tested in S03-binding/scalars.t. Can anybody comment on our current understanding of the array binding cases?
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 532b
Since Rakudo commit 3754356d8e this fails with X::Syntax::Variable::Initializer: $ perl6-m -e 'my @foo := 1..3, @foo; .say for @foo[^10]' ===SORRY!=== Error while compiling -e Cannot use variable @foo in declaration to initialize itself at -e:1 ------> my @foo := 1..3, @⏏foo; .say for @foo[^10] expecting any of: term In other words, binding an array to a list containing the array itself does not work at all. Therefore I'm closing this ticket as 'resolved'. Test: https://github.com/perl6/roast/commit/dca1faef23
Reopened for now.

See RT #121807 and RT #125371 for more info. Basically, there will be no error after I'm done with everything.

In case of binding, @foo will appear as Mu. Binding doesn't make much sense in this case, DIHWIDT.

(Mu Z+ 5) will error out normally.

On 2015-11-10 13:59:32, bartolin@gmx.de wrote:
Show quoted text
> Since Rakudo commit 3754356d8e this fails with
> X::Syntax::Variable::Initializer:
>
> $ perl6-m -e 'my @foo := 1..3, @foo; .say for @foo[^10]'
> ===SORRY!=== Error while compiling -e
> Cannot use variable @foo in declaration to initialize itself
> at -e:1
> ------> my @foo := 1..3, @⏏foo; .say for @foo[^10]
> expecting any of:
> term
>
> In other words, binding an array to a list containing the array itself
> does not work at all. Therefore I'm closing this ticket as 'resolved'.
>
> Test: https://github.com/perl6/roast/commit/dca1faef23


By the way, there is a pull request: https://github.com/rakudo/rakudo/pull/1020

But the work on it is kinda stalled.

On 2017-02-17 04:22:51, alex.jakimenko@gmail.com wrote:
Show quoted text
> Reopened for now.
>
> See RT #121807 and RT #125371 for more info. Basically, there will be
> no error
> after I'm done with everything.
>
> In case of binding, @foo will appear as Mu. Binding doesn't make much
> sense in
> this case, DIHWIDT.
>
> (Mu Z+ 5) will error out normally.
>
> On 2015-11-10 13:59:32, bartolin@gmx.de wrote:
> > Since Rakudo commit 3754356d8e this fails with
> > X::Syntax::Variable::Initializer:
> >
> > $ perl6-m -e 'my @foo := 1..3, @foo; .say for @foo[^10]'
> > ===SORRY!=== Error while compiling -e
> > Cannot use variable @foo in declaration to initialize itself
> > at -e:1
> > ------> my @foo := 1..3, @⏏foo; .say for @foo[^10]
> > expecting any of:
> > term
> >
> > In other words, binding an array to a list containing the array
> > itself
> > does not work at all. Therefore I'm closing this ticket as
> > 'resolved'.
> >
> > Test: https://github.com/perl6/roast/commit/dca1faef23




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org