5 ms·
Code generation isn't as powerful as late binding. Lisps would be more interesting if you could easily manipulate environments, and set the environment that fu
by richcollins 17y ago
Code generation isn't as powerful as late binding. Lisps would be more interesting if you could easily manipulate environments, and set the environment that functions are evaluated in. In this regard, Arc isn't as agile as some OO languages (Io for instance).
- wglb 17y agoI am curious what you mean about "easily manipulate environments" for the functions to be evaluated in.
- smikhanov 17y agoProbably, something similar to JavaScript's call() and apply() is meant here. Though classical Lisps all have funcall and apply (not sure about Arc).
- richcollins 17y agocall and apply only let you change the meaning of the this pointer in Javascript. You can't change the meaning of other bound variables. In Io, you can take a Block and set the scope: makeOriginalScope := block(name := "originalScope"; block(writeln(name))) block(name := "newScope"; makeOriginalScope call setScope(thisContext) call) call //newScope
- stcredzero 17y agoDoes this mean that you can change the meanings of your language's "words" for specific "contexts?" (Context meaning the semantic thing, not a stack frame, though that could be the implementation.)
- richcollins 17y agoYes. The meaning of symbols within a closure can't change after creation. They are always bound to the same variable. In Io, the meanings of symbols are determined when the block is activated.
- stcredzero 17y agoI'll have to take a look at Io. I was just thinking of making contexts into semantic contexts by having users specify what the verbs mean, not just the nouns.
- richcollins 17y agoIo has no "nouns" or keywords. Everything in Io is a verb (a message send). Also, see http://news.ycombinator.com/item?id=630906 http://news.ycombinator.com/item?id=630906
- stcredzero 17y agoA "getter" is just a synonym for something that's a noun.
- stefano 17y agoIsn't this similar to dynamic scope?
- richcollins 17y agoSimilar but not the same. With dynamic scope, the variable lookup is performed up the chain of environments that the function was called in. The only way that you can influence this is by calling the function within a certain scope, you can't explicitly set the scope so it isn't as flexible as Io's scope and it isn't as fast as the lexical scope of most Lisps.
- pmjordan 17y agoClojure's vars can thread-locally, temporarily be re-bound, see http://clojure.org/vars http://clojure.org/vars and http://clojure.org/api#binding http://clojure.org/api#binding