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

Provide a do term, which allows you to inject a statement into an expression #200

Open
masak opened this issue Oct 4, 2016 · 0 comments

Comments

@masak
Copy link
Owner

masak commented Oct 4, 2016

(Though we don't have statement prefixes in 007. It'll most likely just be a kind of term.)

Starting to notice a pattern — for each design decision where we say "007 does this in a simpler way than Perl 6", we can provide a language-mod/macro that re-instates the Perl 6 way. 😄

In this case, do would allow things like the following:

my thing = (stuff // do return).foo();

In other words, do allows you to nest a statement right in the middle of an expression.

Note that, as a first conservative approximation, all statements that don't alter the control flow and can have an actual return value, will have the value None. So you won't be able to do fun stuff like build a retro ternary operator out of do and if. Sorry.

I had this idea when I started to re-read #7.

@masak masak changed the title Provide a do statement prefix Provide a do term, which allows you to inject a statement into an expression Jun 6, 2017
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