Implicit call for function with no arguments #485
Replies: 2 comments 1 reply
-
This would prevent functions from being first-order. For example, you could no longer write: fn3 = fn2 (it would end up calling Maybe certain functions could be "blessed" to be auto-called? But I don't think it makes sense as a default behavior. First-order functions are too important. Speaking of "something like getter but with no object", I think let decorators might be a reasonable approach. |
Beta Was this translation helpful? Give feedback.
-
Something fancy we may be able to do in the far future is auto invoke based on type information: declare f: () => number
x := 5 + f
Even crazier: declare f: () => Promise<number>
x := f + 3
It seems possible for common cases but the edge cases could be a nightmare. |
Beta Was this translation helpful? Give feedback.
-
Something like getter but with no object. Assume will be keyword e.g. "ic" instead of empty parentheses (). The idea is call and get result with no explicit invoke with ().
Now
Desired
Also for functions binded with JS .bind if it no more need arguments.
Desired
Beta Was this translation helpful? Give feedback.
All reactions