3 ms·
> The best solution I have ever seen to global variables is definitely parameterize with Racket (https://docs.racket-lang.org/guide/parameterize.html https://do
by darrenf 8y ago
> The best solution I have ever seen to global variables is definitely parameterize with Racket (https://docs.racket-lang.org/guide/parameterize.html https://docs.racket-lang.org/guide/parameterize.html). I don't think Racket was the first language to come up with this, but it was the first one I am aware of. The basic idea is that you define some global with a default value. However, you can call parameterize to change the value for the duration of some input function.
Isn't that basically Perl's `local`?
- tripa 8y agoIt is, but Lisp did have it first, even if not through Racket.
- eslaught 8y agoYes, it's called dynamic scoping, and for a long time it wasn't believed that the other option (what we call lexical scoping today) could even be implemented efficiently. https://en.wikipedia.org/wiki/Scope_(computer_science)#Dynamic_scoping https://en.wikipedia.org/wiki/Scope_(computer_science)#Dynam...