5 ms·
Dynamic scope is supported in older Lisps (eLisp is the only widely used variant with it), and a variety of scripting languages including PHP, Perl, TCL and vim
by btilly 16y ago
Dynamic scope is supported in older Lisps (eLisp is the only widely used variant with it), and a variety of scripting languages including PHP, Perl, TCL and vimsh (that's vim's internal scripting language). It is rarish because it has been recognized as a bad design, but it still turns up because it is easy to implement.
- bretthoerner 16y ago> eLisp is the only widely used variant with it I think you mean it's the only widely used variant where it's the default. It's available in CL and Clojure when you want (need?) it.
- ratsbane 16y agoIt is often recognized as bad design - though I don't think that's always fair. I thought of this because I was just reading some Java code that passed around a context object with all kinds of random things stuffed into it. It was, in effect, a way of simulating dynamic scope. There's a time and a place for everything. I'm sure dynamic scope can be horribly abused, but it's also nice to have in the toolbox for when you actually need to do what it does.
- xtho 16y agoHow does tcl, php, and vimscript support dynamic scoping? Examples please. IIRC common lisp supports dynamic scoping too -- it defaults to lexical scoping though.