-
Notifications
You must be signed in to change notification settings - Fork 15
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
Implement infix:<//> #151
Comments
no short-circuit? |
Oh, with short-circuit semantics, of course :-) |
ah, so something that'd look like a macro..:) |
Yeah, it'd have the same mechanism as infix:<&&> and infix:<||> already Hm, I wonder how feasible it'd be for an |
How would such a trait even look like? Treat its argument as thunks? |
Well, when the trait is done with it, it certainly can't be a "normal" sub anymore. Here's the original code again for comparison, with the trait added:
And here's the macro I'd expect would be code-gen'd in its place because of the trait:
A couple of stray comments on the above:
(By the way, here's my previous attempt at solving this one, which I now feel went too far in some ways and not far enough in others.) |
(By the way, to any LHF-eager bystanders: this task is still really simple — basically just copy-paste and modify the code for |
I don't understand. By definition, the parameters to the macro are lazily evaluated, since they're just AST slices. That's why a |
All true. Macro params (or rather, the expressions they AST for) are lazily The trait is meant to give the author the lazy macro-param semantics, but infix:<//> felt like a good showcase, especially as it was an honest |
Ah, I'm sorry, I hadn't realized the trait was to be on a sub, not on a macro. |
That blog post aims to eliminate the More damningly though, the thunkish proposal requires the routine author to think about which parameters are thunks. This is hard, and unnecessary. The proposal in this issue is simply to let that information emerge out of the normal control flow in the sub. Is the I felt there was a good idea lurking behind the bad ideas in the "thunkish" post. I think this trait might be it. (Or at least a decent step in the right direction.) |
Two comments, coming back to this issue far later:
Transcript:
|
Whose implementation would simply be
The text was updated successfully, but these errors were encountered: