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

calling .=subst leaves $/ undefined in the closure in the second parameter in Rakudo #1077

Closed
p6rt opened this issue Jun 20, 2009 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 20, 2009

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

Searchable as RT66782$

@p6rt
Copy link
Author

p6rt commented Jun 20, 2009

From @masak

<masak> rakudo​: $_ = 1; .say; .=subst(/(.) $0*/, { $/.chars ~ $0 }, :g); .say
<p6eval> rakudo 1b06df​: OUTPUT«1␤Use of uninitialized value␤Use of
uninitialized value␤0␤»
<masak> I expected that one to say '11' the second time.
<masak> what am I missing?
<pmichaud> I'm not sure.
<masak> rakudo​: $_ = "foo"; say .subst(/o/, { ~$/ }, :g)
<p6eval> rakudo 1b06df​: OUTPUT«foo␤»
<masak> rakudo​: $_ = "foo"; say .=subst(/o/, { ~$/ }, :g)
<p6eval> rakudo 1b06df​: OUTPUT«Use of uninitialized value␤Use of
uninitialized value␤f␤»
* masak submits rakudobug
<TimToady> {} has its own $/ maybe?
<masak> some strange interaction between .= and $/
<masak> TimToady​: that doesn't explain why .subst works above.
<pmichaud> it might be an odd interaction with $_ . Or perhaps with
the way .= has been implemented.

@p6rt
Copy link
Author

p6rt commented Jun 24, 2010

From @cognominal

for 0 { when ARRAY {} }
Missing block at line 1, near "}\n"

The problem : ARRAY is an undefined function.
The message is unhelpful.
Also brain muscles makes type ARRAY for Array pretty easy.

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jun 30, 2010

From @bbkr

On Kiev build

[16​:16] <bbkr> rakudo​: $_ = "foo"; say .=subst(/o/, { ~$/ }, :g)
[16​:16] <p6eval> rakudo aa015a​: OUTPUT«fAny()Any()␤»
[16​:17] <bbkr> it above output corect?
[16​:17] <masak> no.
[16​:18] <masak> bbkr​: ~$/ should contain an 'o' in both evaluations of
the closure.
[16​:18] <masak> s/contain/be/

@p6rt
Copy link
Author

p6rt commented Jun 30, 2010

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

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 6, 2011

From @masak

<sjohnson> A tutor who tooted the flute
<sjohnson> Tried to tutor two tooters to toot
<sjohnson> Said the two to the tutor
<sjohnson> "Is it tougher to toot
<sjohnson> Or to tutor two tooters to toot?"
<tadzik> woot
<sjohnson> heh
<masak> nom​: $_ = 'toot'; s/$/er/; .say; s/oo(.)e/u $0 o/; .say
<p6eval> nom 1c2c2d​: OUTPUT«tooter␤tu or␤»
<masak> is that a known/submitted bug?
<[Coke]> when you submit that, you can golf it down to just the 2nd regexp
<masak> of course :)
<masak> nom​: $_ = 'a'; s/(.)/$0/; .say
<p6eval> nom 1c2c2d​: OUTPUT«␤»
* masak submits rakudobug
<masak> sjohnson​: your poem just found us a rakudobug! :)
<sjohnson> nice!

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

From @moritz

We now have a hackish implementation and a single passing test in
subst.t -- enough for me to close this ticket. Cheers!

@p6rt
Copy link
Author

p6rt commented Oct 8, 2011

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

@p6rt p6rt closed this as completed Oct 8, 2011
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant