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

ENTER blocks return Nil rather than last statement in Rakudo #2999

Closed
p6rt opened this issue Dec 15, 2012 · 5 comments
Closed

ENTER blocks return Nil rather than last statement in Rakudo #2999

p6rt opened this issue Dec 15, 2012 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 15, 2012

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

Searchable as RT116102$

@p6rt
Copy link
Author

p6rt commented Dec 15, 2012

From @masak

<masak> r​: my $in_prompt; sub issue_prompt { say ENTER { $in_prompt =
True; 42 } }; issue_prompt
<p6eval> rakudo cf2761​: OUTPUT«Nil␤»
<masak> jnthn​: why is the return value of the ENTER block Nil?
<jnthn> masak​: Probably 'cus it doesn't support r-value use.
<jnthn> masak​: Feel free to research in the spec if it should. :)
<masak> hokay.
<jnthn> And if the spec thinks it should, feel free to file a ticket :)
<masak> jnthn​: I don't see anything in S04 says they're not rvalues.
<masak> jnthn​: in fact, I'd expect ENTER to work as either an rvalue
or lvalue in block form.
<masak> r​: say ENTER { 42 }
<p6eval> rakudo cf2761​: OUTPUT«Nil␤»
<jnthn> masak​: Well, clearly a bunch of phasers are useless as r-values.
<masak> jnthn​: those that haven't happened yet, yes.
<jnthn> Like LEAVE :)
<masak> of course.
<masak> I'm not arguing against that :)
<jnthn> But yeah, I think ENTER should work
<jnthn> There's probably some nice things to do with it.
<jnthn> LEAVE say "We took {now - ENTER now}s to run";
<jnthn> For example

@p6rt
Copy link
Author

p6rt commented Oct 8, 2014

From @usev6

Just an update​: ENTER blocks still return Nil​:

say ENTER { 42 }
Nil

S04 states ENTER can be used for its return value (http://perlcabal.org/syn/S04.html#Phasers)

@p6rt
Copy link
Author

p6rt commented Oct 8, 2014

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

@p6rt
Copy link
Author

p6rt commented Jun 29, 2015

From @jnthn

On Wed Oct 08 04​:53​:49 2014, bartolin@​gmx.de wrote​:

Just an update​: ENTER blocks still return Nil​:

say ENTER { 42 }
Nil

S04 states ENTER can be used for its return value
(http://perlcabal.org/syn/S04.html#Phasers)

Implemented, and test added in S04-phasers/enter-leave.t.

@p6rt p6rt closed this as completed Jun 29, 2015
@p6rt
Copy link
Author

p6rt commented Jun 29, 2015

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

@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