4 ms·
I can't think of any recently-designed languages that do not have lexical scoping - can you? I'm not sure I can think of any languages at all that have dynamic
by chrisseaton 12y ago
I can't think of any recently-designed languages that do not have lexical scoping - can you?
I'm not sure I can think of any languages at all that have dynamic scoping since the early lisps.
- Igglyboo 12y agoThe only ones I can think of are Python and Javascript, both were created in the 90's.
- chrisseaton 12y agoPython and JavaScript both have lexical scoping - e.g. http://www.ecma-international.org/ecma-262/5.1/#sec-10.2 http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.
- Igglyboo 12y agoAh my mistake then, I must be misunderstanding what lexical scoping is.
- axiomabsolute 12y agoFeatures like Scala's implicit parameters could be argued to be a kind of "dynamic scope". True, the language is lexically scoped and most code is written expecting that, but it does allow you to "opt out" of this scoping mechanism and look for values to be specified in the environment.
- marktangotango 12y agoPerl my/our/local is the most unusual scoping I know of[1]. But still lexical, except maybe local which is more like an alias? [1] http://www.perlmonks.org/?node_id=66677 http://www.perlmonks.org/?node_id=66677
- tripa 12y agomy is lexical, our is global, local is dynamic.
- tripa 12y agoI'll premptively add a bit of precision before a pedant comes along: my is lexical all the way; our defines a lexical binding over a global variable, and local defines a dynamic binding (of lexical extent) over a global.
- AnimalMuppet 12y agoAre you sure the pedant hasn't already arrived? ;-)