nlfiedler / bakeneko

Scheme R7RS interpreter in Go
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Add an "Any" type to Scheme interpreter #4

Closed nlfiedler closed 10 years ago

nlfiedler commented 11 years ago

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.

nlfiedler commented 11 years ago

Started to do this but seems rather difficult. Will look into it further at anther time.

nlfiedler commented 11 years ago

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.

nlfiedler commented 10 years ago

Location information issue has been resolved. The question of what purpose the Any would serve remains.

nlfiedler commented 10 years ago

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.