3 ms·
>> How can you fix [X] without breaking almost all existing [Y] code? For most cases of X, some form of declaration that is scope bound. Look at e.g. Perl, it
by BugBrother 12y ago
>> How can you fix [X] without breaking almost all existing [Y] code?
For most cases of X, some form of declaration that is scope bound.
Look at e.g. Perl, it changes quickly in this way, with very good backwards compatibility. [Also see strict mode, of course.]
Edit: That said, new keywords like those let/const/module/extends etc should work fine. Please give me them today.
Edit 2: I have been cursing the lack of multiple returns this week. It is a pain returning a hash/object or an array. That really isn't supported, from browsing the standard? :-(
- espadrine 12y ago> Edit 2: I have been cursing the lack of multiple returns this week. It is a pain returning a hash/object or an array. Why is that? let rational = (a, b) => [a, b]; let [numerator, denominator] = rational(38, 4); let reduced = rational(numerator/2, denominator/2); PS. The above code works in stable Firefox.
- BugBrother 12y ago>> Why is that? <Cough> Obviously because I'm blind? :-) Thanks.
- gsnedders 12y agoThere's an unwillingness to introduce too many opt-ins into JS as it quickly leads to ever increasing implementation complexity. Note that Perl is one of the few notable languages to have such sort of opt-ins.