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

Using 'where' and '&sub.assuming' together produces incorrect results in Rakudo #1417

Closed
p6rt opened this issue Nov 27, 2009 · 7 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Nov 27, 2009

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

Searchable as RT70890$

@p6rt
Copy link
Author

p6rt commented Nov 27, 2009

From @masak

<masak> rakudo​: sub foo($b) { $b == 42 }; subset FortyTwo of Int where
&foo; say 42 ~~ FortyTwo
<masak> rakudo​: sub foo($a, $b) { $b == 42 }; subset FortyTwo of Int
where &foo.assuming(0); say 42 ~~ FortyTwo
<p6eval> rakudo 7347ec​: ( no output )
<p6eval> rakudo 7347ec​: ( no output )
<masak> locally, the first one gives 1 and the second one gives a 'Not
enough positional parameters passed'.
<masak> jnthn​: should the second one work?
<jnthn> masak​: Um
<jnthn> masak​: I *think* so.
<jnthn> Since that should return a curried sub.
<jnthn> .oO( mmm...vindaloo )
<masak> :)
* masak submits the where-and-assuming rakudobug

@p6rt
Copy link
Author

p6rt commented Jul 19, 2010

From @masak

On Fri Nov 27 14​:26​:28 2009, masak wrote​:

<masak> rakudo​: sub foo($b) { $b == 42 }; subset FortyTwo of Int where
&foo; say 42 ~~ FortyTwo
<masak> rakudo​: sub foo($a, $b) { $b == 42 }; subset FortyTwo of Int
where &foo.assuming(0); say 42 ~~ FortyTwo
<p6eval> rakudo 7347ec​: ( no output )
<p6eval> rakudo 7347ec​: ( no output )
<masak> locally, the first one gives 1 and the second one gives a 'Not
enough positional parameters passed'.

<masak> rakudo​: our sub foo($a, $b) { $b == 42 }; subset FortyTwo of Int where
&foo.assuming(0); say 42 ~~ FortyTwo
<p6eval> rakudo 2f4733​: OUTPUT«0␤»
<masak> heh. now it doesn't die, but it gives the wrong answer...
* masak adds that to http://rt.perl.org/rt3/Ticket/Display.html?id=70890

@p6rt
Copy link
Author

p6rt commented Jul 19, 2010

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

@p6rt
Copy link
Author

p6rt commented Jul 19, 2010

From @masak

<jnthn> rakudo​: our sub foo($a, $b) { say 'unicorn!!! \o/'; $b == 42 }; subset FortyTwo of Int
where &foo.assuming(0); say 42 ~~ FortyTwo; say 42 ~~ FortyTwo;
<p6eval> rakudo 2f4733​: OUTPUT«0␤0␤»
<jnthn> Nope, it never calls it.
<jnthn> oh well
<jnthn> Oh!!
<jnthn> masak​: I bet it's that assuming doesn't return something that isa Block
<jnthn> masak​: bugs. lots of bugs.
<jnthn> masak​: I also just spied a spectest that fails if you'd made that a my sub too...
* masak adds all this to the ticket

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

On Mon Jul 19 13​:52​:15 2010, masak wrote​:

<jnthn> rakudo​: our sub foo($a, $b) { say 'unicorn!!! \o/'; $b == 42
}; subset FortyTwo of Int
where &foo.assuming(0); say 42 ~~ FortyTwo; say 42 ~~ FortyTwo;
<p6eval> rakudo 2f4733​: OUTPUT«0␤0␤»
<jnthn> Nope, it never calls it.
<jnthn> oh well
<jnthn> Oh!!
<jnthn> masak​: I bet it's that assuming doesn't return something that
isa Block
<jnthn> masak​: bugs. lots of bugs.
<jnthn> masak​: I also just spied a spectest that fails if you'd made
that a my sub too...
* masak adds all this to the ticket

working now. marking testneeded.

16​:26 <diakopter> rakudo​: our sub foo($a, $b) { say 'unicorn!!! \o/'; $b
== 42 }; subset
  FortyTwo of Int where &foo.assuming(0); say 42 ~~
FortyTwo; say 42 ~~
  FortyTwo;
16​:26 <p6eval> rakudo 024843​: OUTPUT«unicorn!!! \o/␤True␤unicorn!!!
\o/␤True␤»

@p6rt
Copy link
Author

p6rt commented Jun 2, 2012

From @diakopter

On Tue May 29 14​:27​:00 2012, diakopter wrote​:

On Mon Jul 19 13​:52​:15 2010, masak wrote​:

<jnthn> rakudo​: our sub foo($a, $b) { say 'unicorn!!! \o/'; $b == 42
}; subset FortyTwo of Int
where &foo.assuming(0); say 42 ~~ FortyTwo; say 42 ~~ FortyTwo;
<p6eval> rakudo 2f4733​: OUTPUT«0␤0␤»
<jnthn> Nope, it never calls it.
<jnthn> oh well
<jnthn> Oh!!
<jnthn> masak​: I bet it's that assuming doesn't return something
that
isa Block
<jnthn> masak​: bugs. lots of bugs.
<jnthn> masak​: I also just spied a spectest that fails if you'd made
that a my sub too...
* masak adds all this to the ticket

working now. marking testneeded.

16​:26 <diakopter> rakudo​: our sub foo($a, $b) { say 'unicorn!!! \o/';
$b
== 42 }; subset
FortyTwo of Int where &foo.assuming(0); say 42 ~~
FortyTwo; say 42 ~~
FortyTwo;
16​:26 <p6eval> rakudo 024843​: OUTPUT«unicorn!!! \o/␤True␤unicorn!!!
\o/␤True␤»

19​:13 <+dalek> roast​: 099ceda | diakopter++ | S06-currying/mixed.t​:
19​:13 <+dalek> roast​: add test for RT #​70890. resolves ticket.
19​:13 <+dalek> roast​: review​:
Raku/roast@099cedad93

@p6rt
Copy link
Author

p6rt commented Jun 2, 2012

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

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