"a variable is not required to have its type declared nor are types associated with properties" (ECMAScript 2016 spec, 4.2)
Re:Electron considered harmful
by tlrobinson on Thursday November 24, 2016 @01:25PM
(#13031864)
Are you suggesting all dynamically typed languages are "terrible"?
Re:Electron considered harmful
by marcosdumay on Thursday November 24, 2016 @02:18PM
(#13032194)
The only languages I can think that share those properties are Perl (5, don't know about 6) and the retired Visual Basic.
There is more there than dynamic typing.
Re:Electron considered harmful
by tlrobinson on Thursday November 24, 2016 @03:03PM
(#13032427)
Not sure what I'm missing. Ruby? Python?
Re:Electron considered harmful
by marcosdumay on Friday November 25, 2016 @05:22AM
(#13035648)
You are missing this part: nor are types associated with properties.
Ruby and Python do not fit it.
Re:Electron considered harmful
by tlrobinson on Friday November 25, 2016 @06:51AM
(#13036060)
You can assign values of different types to the same property in those languages, no?
Re:Electron considered harmful
by marcosdumay on Monday November 28, 2016 @07:42AM
(#13055028)
Types dictate¹ what properties are available.
1 - Or, in the case of Python, mostly dictate.
Re:Electron considered harmful
by errantspark on Thursday November 24, 2016 @01:29PM
(#13031893)
Cute. Smalltalk and LISP are terrible too huh?
Lisp is marginally better, because it tries less hard to work around type mismatches (so something like (+ 1 "") is an error). But it suffers from the same fundamental problem: no type checks until runtime.
It's fine to have some kind of option for data whose type isn't known until runtime. This stuff happens, and languages that insist there's no such thing make dealing with it more difficult. But this is the rarer case! Why optimise for it rather than for the more common one?
What Lisp are you developing with? Mature "industrial strength" Lisp compilers do perform type checks prior to run time.
Dynamic typing isn't optimization; dynamic typing without any static analysis is the utter lack of optimization.
[Citation needed]
Sorry, JavaScript may have gotten lucky being the lingua franca of the web, and it might not be perfect or even great, but it's "good enough" for most purposes these days.
If it were "terrible" you would expect at least one compile-to-JS [1] to have gained a non-trivial amount of traction by now. The supersets of JavaScript like Babel, TypeScript, and Flow are more popular than "not terrible" languages like ClojureScript, Elm, etc.
1. https://github.com/jashkenas/coffeescript/wiki/list-of-langu...