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

Suggestion: better alternatives for ifnull and ifvoid #30

Open
kristianmandrup opened this issue Mar 6, 2017 · 1 comment
Open

Suggestion: better alternatives for ifnull and ifvoid #30

kristianmandrup opened this issue Mar 6, 2017 · 1 comment

Comments

@kristianmandrup
Copy link

a ifnull: 8 equivalent to a = a || 8 or a ||= 8 in ruby.
For fus it could be a: self | 8 or perhaps a: ? 8

In general null is known as the billion dollar mistake

For a ifvoid: 8 # if (a === undefined) {a = 8;} could be a: ! 8 ie. must be 8 if not defined.

b: a ifvoid 8 # b = a !== undefined ? a : 8; could then be b: a ! 8 set b to a and must be 8 if a not yet defined

@zhanzhenzhen
Copy link
Owner

I have a plan of adding some new grammars:

b: a ok.or 8
b: a exist.or 8

equivalent to:

b: a ifnull 8
b: a ifvoid 8

I admit that ifnull and ifvoid may be not very intuitive in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants