Re:Making the Most of the JavaScript Language (2016)
by savanaly on Thursday August 03, 2017 @05:04PM
(#14923873)
What feels wrong about it?
[ Parent
| on HN ]
Re:Making the Most of the JavaScript Language (2016)
by romanovcode on Friday August 04, 2017 @05:20AM
(#14927374)
You wouldn't declare your in-scope variables as `const` in C/C++/C#/Java wold you?
Re:Making the Most of the JavaScript Language (2016)
by clappski on Friday August 04, 2017 @05:35AM
(#14927423)
In C++ I always do, everything is 'const auto &' if it can be. C# const is different, it's more like C++ '#define'.
Why wouldn't you always go for the most immuatable declaration? Even in C++, where you can have 'const int f(const int y) const;' it's still worth using even though you have to type it a few times.
Re:Making the Most of the JavaScript Language (2016)
by aaron-lebo on Thursday August 03, 2017 @05:25PM
(#14924036)
It's an incredibly verbose way to do what you'd prefer to be the default.
val or con would have been better.
Re:Making the Most of the JavaScript Language (2016)
by WorldMaker on Friday August 04, 2017 @02:42PM
(#14930910)
Going way back to ancient Lisps `let` has been the const declaration in a lot of programming languages. It's too bad ES2015 decided to use `let` for `var`/`val`, because `let` should have been const.
That said, I've come to terms with const, even if I find I accidentally use let sometimes from time spent in Lisp and F#.
Re:Making the Most of the JavaScript Language (2016)
by kazinator on Friday August 04, 2017 @11:31PM
(#14934076)
let is not a "const declaration" in most major dialects of Lisp, current and historic. In Scheme, Common Lisp, ISLisp, Emacs Lisp and others, it introduces mutable bindings.
Re:Making the Most of the JavaScript Language (2016)
by WorldMaker on Monday August 07, 2017 @03:29PM
(#14950465)
Apologies, my Common Lisp is getting rusty.
Re:Making the Most of the JavaScript Language (2016)
by simonbw on Thursday August 03, 2017 @06:34PM
(#14924585)
Is there really much of a difference between "const" and "con"? I get that one is 66% longer than the other, but does it actually affect the readability of the code or the amount of time it takes to write it?
Re:Making the Most of the JavaScript Language (2016)
by kazinator on Friday August 04, 2017 @11:32PM
(#14934079)
Can't we compromise half way? How about cons!
/whistle .../
Re:Making the Most of the JavaScript Language (2016)
by BurningFrog on Thursday August 03, 2017 @06:20PM
(#14924469)
Yeah, those 60% extra characters do bother me. And the uneven indentation.
I know some/most people don't care. I can't be one of them.
Maybe we'll get `val` in ES9.