Re:TC39, ECMAScript, and the Future of JavaScript
by danielbarla on Tuesday June 27, 2017 @03:58AM
(#14643287)
That's interesting. My knowledge of JS is a bit lacking, so I'm struggling to see the equivalence of the interfaces approach. E.g., is it possible to parametrize interfaces with actual values, such as @maxLength(20)? Also, how do you apply interfaces down to the field-level, where they are of primitive types, such as number or string?
Re:TC39, ECMAScript, and the Future of JavaScript
by abritinthebay on Tuesday June 27, 2017 @11:35AM
(#14646345)
That feels like a job for getters/setters, no?
Re:TC39, ECMAScript, and the Future of JavaScript
by danielbarla on Wednesday June 28, 2017 @01:33AM
(#14651915)
I guess it depends what style you favour. I can't imagine using getters/setters like that in JS today, and not have major pains from it (things like not being able to use data binding frameworks easily, etc).
If we were talking about very basic things then yes, sure, but I’d also argue that if they are truly basic then we could restrict decorators to built-in ones only (as those are the basics).
Much like there are “magic” Symbols like Symbol.iterator.