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

flip flop operator (infix:<ff>) gobbles up $_ #2720

Closed
p6rt opened this issue Apr 19, 2012 · 6 comments
Closed

flip flop operator (infix:<ff>) gobbles up $_ #2720

p6rt opened this issue Apr 19, 2012 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Apr 19, 2012

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

Searchable as RT112540$

@p6rt
Copy link
Author

p6rt commented Jan 7, 2012

From @moritz

21​:04 < moritz> nom​: $_ = 'a'; /a/ ff /a/;
21​:04 <+p6eval> nom 327fc9​: OUTPUT«Method 'match' not found for invocant
of class 'Any'â�¤ in method Bool at src/gen/CORE.setting​:7239â�¤ in sub
infix​:<ff> at src/gen/CORE.setting​:8502â�¤ in block <anon> at
/tmp/YknKE09sGg​:1â�¤ in <anon> at /tmp/YknKE09sGg​:1â�¤Â»

the $_ that /a/ matches against ends up being Any, not 'a'. Compare with​:

21​:04 < moritz> nom​: $_ = 'a'; /a/ || /a/;
21​:04 <+p6eval> nom 327fc9​: ( no output )

works fine there

21​:05 < sorear> nom​: $_ = 'a'; m/a/ ff m/a/
21​:05 <+p6eval> nom 327fc9​: ( no output )
21​:05 < sorear> I think I see the problem
21​:06 < moritz> sorear​: what is it?
21​:07 < moritz> ah, probably the sub infix​:<ff>($a as Bool, $b as Bool)
21​:07 < sorear> moritz​: 'ff' is probably calling a helper sub, which
calls .Bool on the arguments ... but $_ doesn't exist in the helper sub
21​:07 < moritz> tries to coerce the regex to Bool, but no $_ present anymore

@p6rt
Copy link
Author

p6rt commented Apr 19, 2012

From @bbkr

$ perl6 -e '$_ = "foo"; if /./ ff /./ { .say } '
Method 'match' not found for invocant of class 'Any'
  in method Bool at src/gen/CORE.setting​:8102
  in sub infix​:<ff> at src/gen/CORE.setting​:9398
  in block <anon> at -e​:1

Conditions like "if /./ {} " works fine, somehow second /./ in flip-flop is not matched against $_.

This is perl6 version 2012.03-51-gcb61d59 built on parrot 4.2.0 revision RELEASE_4_2_0-98-gda3ed58

@p6rt
Copy link
Author

p6rt commented May 9, 2012

From @jnthn

On Thu Apr 19 04​:30​:56 2012, pawel.pabian@​implix.com wrote​:

$ perl6 -e '$_ = "foo"; if /./ ff /./ { .say } '
Method 'match' not found for invocant of class 'Any'
in method Bool at src/gen/CORE.setting​:8102
in sub infix​:<ff> at src/gen/CORE.setting​:9398
in block <anon> at -e​:1

Conditions like "if /./ {} " works fine, somehow second /./ in flip-
flop is not matched against $_.

This is perl6 version 2012.03-51-gcb61d59 built on parrot 4.2.0
revision RELEASE_4_2_0-98-gda3ed58

Seems to work now, after recent ff improvements​:

$_ = "foo"; if /./ ff /./ { .say }
foo

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented May 9, 2012

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

@p6rt
Copy link
Author

p6rt commented Jun 5, 2012

From @moritz

S03-operators/flip-flop.t has plenty of coverage already.

@p6rt
Copy link
Author

p6rt commented Jun 5, 2012

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

@p6rt p6rt closed this as completed Jun 5, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
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