Open spy16 opened 4 years ago
If we go for option 1, I think we should at least give the empty interface a type, e..g: type Value interface{}
. This achieves two things:
interface{}
or something else?)Note that there is precedent for this approach.
Concerning option 2, I'm not sure what we obtain from having the Source()
method.
Option 3 is also fine. It avoids a type assertion, which has performance implications. I'm not sure how much we care about this, though.
Ultimately it's up to you -- I don't have strong feelings about this either way.
Yep agreed on all. Performance is not big enough concern to warrant any targeted optimization but I would still like to keep the overhead to minimum. I've decided to keep it as is for now. We can think about this again at some point later..
Most of the Value types (except for Symbol, List, Vector, Set), return themselves on
Eval()
.. It seems like a redundant requirement to have all Values implement theEval()
method when in most cases it's not required.. I am considering may be it would be simpler to remove this and make Eval() an optional interface.. We have 3 possibilities:Value
type altogether and deal withinterface{}
types.Turn
Value
into a marker interface like below:If we choose 1 or 2, eval requirement can become an optional interface:
@lthibault Any thoughts on this ?