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

defined(Pair object) behaves strangely #1925

Closed
p6rt opened this issue Jul 10, 2010 · 6 comments
Closed

defined(Pair object) behaves strangely #1925

p6rt opened this issue Jul 10, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jul 10, 2010

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

Searchable as RT76448$

@p6rt
Copy link
Author

p6rt commented Jul 10, 2010

From @masak

<moritz_> rakudo​: sub f($t?) { say defined($t).Int }; f("a" => 3)
<p6eval> rakudo 692aa1​: ( no output )
<moritz_> gives "Method 'Int' not found for invocant of class 'Pair'" locally
<moritz_> which is wrong too, no?
<moritz_> is defined() parsed specially?
<masak> moritz_​: no.
<moritz_> so another bug?
<masak> let me confirm locally.
<TimToady> rakudo​: say defined("a" => 3).WHAT
<p6eval> rakudo 692aa1​: OUTPUT«0␤»
<masak> moritz_​: I get the same.
* masak submits rakudobug
<masak> rakudo​: sub f($t?) { say defined($t).WHAT }; f()
<p6eval> rakudo 692aa1​: OUTPUT«0␤»
<masak> o.O

@p6rt
Copy link
Author

p6rt commented Jul 18, 2010

From @moritz

Golfing even further​:

perl6 -e 'defined("a" => 3).Int'
Method 'Int' not found for invocant of class 'Pair'

16​:54 < tylercurtis> moritz​: I think that's parsing as defined(("a" =>
3).Int).

@p6rt
Copy link
Author

p6rt commented Jul 18, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 10, 2011

From @coke

On Sun Jul 18 08​:02​:35 2010, moritz wrote​:

Golfing even further​:

perl6 -e 'defined("a" => 3).Int'
Method 'Int' not found for invocant of class 'Pair'

16​:54 < tylercurtis> moritz​: I think that's parsing as defined(("a" =>
3).Int).

Unchanged​:

19​:16 < [Coke]> rakudo​: sub f($t?) { say defined($t).Int }; f("a" => 3)
19​:16 <+p6eval> rakudo 38907e​: OUTPUT«Method 'Int' not found for invocant of
  class 'Pair'␤ in sub f at /tmp/Szt0vkNBsZ​:1␤ in block <anon>
  at /tmp/Szt0vkNBsZ​:1␤ in <anon> at /tmp/Szt0vkNBsZ​:1␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Mar 31, 2012

From @moritz

FWIW the problem was that 'defined' was a prefix op in rakudo, and had a
precedence tighter than infix =>.

I have changed it now to be an ordinary listop, and added tests to
S32-scalar/defined.t.

@p6rt
Copy link
Author

p6rt commented Mar 31, 2012

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

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