3 ms·
>Special variables seems really like a take it or leave it idea. I'm really not convinced that keeping these as explicit arguments of a function are a bad idea.
by loewenskind 16y ago
>Special variables seems really like a take it or leave it idea. I'm really not convinced that keeping these as explicit arguments of a function are a bad idea. I really like the ability to reason about a function by simply knowing its arguments (including the mplicit self/this).
Haskell has an equally (arguably better) way of dealing with this but a lot of people find it a bit heavy weight.
When you compare it to OO languages, it becomes and obvious win. Any private data member of an object is an implicit/global variable to all methods of that class. If you have a stack trace in Java where one of those members seems to have an impossible value you have no way of knowing how it got there.
In Lisp this problem doesn't have to exist (ironically, I don't think class members in CLOS can be special, but I'm not certain). If you make your implicit variables special then any time that impossible value comes up and breaks the program you need only look in the stack trace. The culprit must be there because if it wasn't the bad value wouldn't be in effect.
Now, if you've ever programmed with the standard OO languages think about how much time that would have saved you.