3 ms·
"a variable is not required to have its type declared nor are types associated with properties" (ECMAScript 2016 spec, 4.2)
by to3m 10y ago
"a variable is not required to have its type declared nor are types associated with properties" (ECMAScript 2016 spec, 4.2)
- tlrobinson 10y agoAre you suggesting all dynamically typed languages are "terrible"?
- marcosdumay 10y agoThe 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.
- tlrobinson 10y agoNot sure what I'm missing. Ruby? Python?
- marcosdumay 10y agoYou are missing this part: nor are types associated with properties. Ruby and Python do not fit it.
- tlrobinson 10y agoYou can assign values of different types to the same property in those languages, no?
- marcosdumay 10y agoTypes dictate¹ what properties are available. 1 - Or, in the case of Python, mostly dictate.
- errantspark 10y agoCute. Smalltalk and LISP are terrible too huh?
- to3m 10y agoLisp 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?
- kazinator 10y agoWhat 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.