You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'll have three objects, number, string, and list
list will hold Objects so it can contain strings, integers, or other lists.
Update the environment package so the variables are now map[string] *Object
Annoyingly at that point we'll almost certainly need to change our function signatures for HostFunction to read:
function func(i *Interpreter, args []*Object) (Object, error)
Once that is done we'll have:
The interpreter allowing different types.
The built-in functions, such as list, returning those types.
The other complication will be that we'll need to validate types on our primitives, not just argument-counts.
e.g. exit will need to ensure it has "string|number". Similarly the return value of interpreter.Evaluate and interpreter.Eval will need to be *Object,error rather than string,error
So significant churn, but the actual steps are pretty simple.
The text was updated successfully, but these errors were encountered:
Tagged wontfix because I think the effort involved will be pretty substantial, even if logically the description above shows that it can be done in a series of discrete steps.
The biggest stumbling block will probably be collecting the arguments ahead of calling the function(s).
number
,string
, andlist
list
will hold Objects so it can contain strings, integers, or other lists.environment
package so the variables are nowmap[string] *Object
Annoyingly at that point we'll almost certainly need to change our function signatures for
HostFunction
to read:Once that is done we'll have:
list
, returning those types.The other complication will be that we'll need to validate types on our primitives, not just argument-counts.
e.g.
exit
will need to ensure it has "string|number". Similarly the return value ofinterpreter.Evaluate
andinterpreter.Eval
will need to be*Object,error
rather thanstring,error
So significant churn, but the actual steps are pretty simple.
The text was updated successfully, but these errors were encountered: