-
Notifications
You must be signed in to change notification settings - Fork 156
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
Idea: Improve typeof #178
Comments
Use it as an expression
|
Better?:
|
Note that
|
@satyr I'm mystified. Why do these produce different values?
More importantly, can we improve the native |
Because it triggers the unary spread. |
Perhaps unary spread is no longer needed in LiveScript, and could be removed in order to have fewer special cases, as we can simply use operators as functions.
A bit longer yes, but I think worth it in reducing the amount of special cases a programmer needs to keep in mind. |
I just think typeof! Shouldn't be unary spreaded. (I don't see why you'd use typeof! [...] anyway but ...) |
@gkz +1 reduce special cases (where the payoff is low). And what about simply fixing the standard
|
@gkz: +1 get rid of unary spread. It's a neat feature, but leads to some confusing/unintuitive behaviours, and it's unnecessary as you say. |
Like I said - Unary spread is really cool, removing typeof from unary spreading wouldn't be better ? |
LiveScript
|
|
@Nami-Doc Two versions of |
You may want the native version. |
@Nami-Doc Keyword |
It's also meant to be compatible with coffeescript. Or just when you're starting LS |
@Nami-Doc An incompatibility worth making. Type-checking is fundamental. Should we really waste metons working around it.
^ Or we can use a tool like Ad infinitum:
I would really like to see this real problem solved. Reading through the articles it appears that there's more we may want to do to ( |
typeof! [1,2,3] looks like I'd recommend Note that it's sometimes tricky to use duck-typing or to fix typeof across ->> Josh <<- |
@josher19 +1 that the bang in
Just throwing this out there
Possible improvements could include:
|
I think @josher19 means |
@renekooi Then
VS
To my intuition it is obvious which one is better. The operator name, |
(You can already infix with the backticks, but I agree with type-of) |
@jasonkuhrt I know, I didn't mean a function, but |
One advantage of current
See also:
@gkz, +1 get rid of unary spread. |
@josher19 make an issue about Also @josher19 couldn't we compile down to a
|
Whoops ;). |
Is there any consensus here? If not we should just close the issue for real. It wouldn't be a huge deal to just create a |
Unary spread is now better documented @jasonkuhrt I'd be okay with |
@Nami-Doc Overloadding the But, if |
I think getting rid of unary spread would make everything so much simpler, so that's a win. You can compose things easily because you can section operators into first-class functions, thus: types-of = map (typeof) I also vote for renaming |
I'll go ahead and reopen this one (from #523). I think with the |
After (the still undocumented, alas) #863, it doesn't seem like there are any outstanding needs here, so I'll reclose. |
it's not well documented what typeof! returns |
Question:
Why does
typeof! [1,2,3]
return 'Number'?Idea:
Can we interchange
typeof
andtypeof!
so that the operator we know and hate can become the operator we know and love? The lesser of the two should be hidden behind alt syntax.My only concern is not being able to
typeof
arrays as questioned above.The text was updated successfully, but these errors were encountered: