-
Notifications
You must be signed in to change notification settings - Fork 48
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
"Truthy pipe" syntax proposition #197
Comments
A new operator solely for omitting at most 7 bytes in a narrow situation sounds overkill. |
Closing for the reason above.
As for this issue, |
On a single line, isn't it going to conflict with post-if specialcase ? |
What specialcase exactly? |
I'm talking about inline implicit object rule (something like that), 140c648. |
The brace-insertion for implicit objects kicks in before the parser job. They may seem to interact oddly, but not in a conflicting way. |
I don't really get what happens in cases like |
It goes:
↓
↓
Hm. Probably |
Yeah, that's what I thought. |
For a lark, I wanted to see what some Django ORM code might look like in Coco and ended up with
-- this works alright, but the second line of the chain is kinda ugly because of the else branch.
So I'd propose a "truthy pipe" syntax, perhaps
?>
, so any falsy values in that block would be emitted as&
instead.Currently, with Coco 0.9, with
|>
instead of?>
the following JS is emitted (I've added some linebreaks for readability), and obviously the "void 8" emitted as the implicit "else" breaks the chaining.In addition I wouldn't mind it if
?>
had a slightly different precedence so the parentheses in the post-if wouldn't be necessary...The text was updated successfully, but these errors were encountered: