Closed nlfiedler closed 10 years ago
Started to do this but seems rather difficult. Will look into it further at anther time.
Okay, will need this for the error location reporting work, so that an Any implementation can hold the original token (or at least the file/row/col where the token was encountered). The key is that the Any type offers String() and Eval() methods, and all of the parser and interpreter code works with these Any instances, and ultimately Eval() is called on the thing to produce a value.
Location information issue has been resolved. The question of what purpose the Any would serve remains.
Cannot figure out how this is useful at all. If there is a need to extract additional, narrowly focused, interfaces at a later time, it is pretty easy to do so with Go. For now, there's no advantage to an Any type.
This is a design issue with the Scheme interpreter, in that it is using Go's interface{} meta type everywhere. Really need to create a basic "anything" type that supports a small number of common operations for Scheme objects. Make Atom implement this new type. Then seek out all the occurrences of interface{} and determine if they would be better represented as Any.