4 ms·
"The omission of variable declarations has nothing to do with dynamic typing." I was inclined to say this as well when I was critiquing the first point (http:/
by akkartik 15y ago
"The omission of variable declarations has nothing to do with dynamic typing."
I was inclined to say this as well when I was critiquing the first point (http://news.ycombinator.com/item?id=3633351 http://news.ycombinator.com/item?id=3633351). But on further thought, just about the only dynamic language that flags assignment to a typo'd variable name is scheme[1]. So it seems like a significant correlation.
[1] Not common lisp. Does clojure?
- tikhonj 15y agoJavaScript with "use strict"--which is basically the modern version of JavaScript, but has to be enabled explicitly because of backwards compatibility--also warns you about assigning a variable that hasn't been declared. Just shows that JavaScript really was influenced by Scheme :).
- gcv 15y agoIn both languages, the use of a variable is almost always preceded by a binding of that variable to a symbol or var using the "let" form. This accounts for most uses of variables, and attempting to access a misspelled variable will flag an error at compile-time. With regard to destructive assignment, most Common Lisp compilers warn on setf calls when executed against unbound symbols. Clojure doesn't have even have assignment in the sense discussed here (refs are bound before use, and the compiler enforces this).