: Thursday, December 29, 2011 5:38:54 AM
Subject: Preparing for type guards
Once we have type guards, I would expect the JavaScript programming style to
slightly change. Currently, number-valued arguments are implemented like this:
function foo(x) {
x = Number(x);
}
With guards
Once we have type guards, I would expect the JavaScript programming style to
slightly change. Currently, number-valued arguments are implemented like this:
function foo(x) {
x = Number(x);
}
With guards, you would use:
function foo(x :: Number) {
}
It might make sense
Aren't you assuming a certain kind of guards, namely converting rather than
throwing? There's no way to future-proof without more agreement on what the
default meaning of x :: Number would be, and (AFAIK) we don't have consensus
yet.
Yes, in the future of JavaScript, I’d expect more
3 matches
Mail list logo