2 ms·
> As far as scoping goes, I shouldn't have to explicity declare a variable lexically scoped - and I can't think of any other language where I do. Really? I can
by __david__ 16y ago
> As far as scoping goes, I shouldn't have to explicity declare a variable lexically scoped - and I can't think of any other language where I do.
Really? I can think of a few: How about C, C++, Java, Lisp, and Javascript? (Yeah, technically javascript is function scoped if you declare it with "var", but you have to do that to prevent it from being global).
- grammaton 16y ago> How about C, C++, Java You do realize they all default to lexical variables, and if you want something else, you have to declare accordingly, right? >Lisp Is a beautiful language, and primarily a play-toy for academics with a handful of real-world applications. While we're at it, which Lisp? Ansi Common? > Javascript I believe it is exactly this quirk in Javascript's scoping that is a major complaint of many developers - although I don't know much javascript and can't speak with authority here.
- __david__ 16y ago> You do realize they all default to lexical variables, and if you want something else, you have to declare accordingly, right? I don't understand your argument. You have to explicitly declare lexical variables in those languages. Ditto for Perl: $ perl -e 'use strict; sub x { $i = 0 }' Global symbol "$i" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors.