Closed DylanSp closed 4 years ago
How to incorporate into type of evaluate
? Instead of just returning Value
, return (Array<Value>, Value)
, where the first part is the printed outputs and the second part is the returned value?
Alternatively, drop the mandatory top-level return?
Instead of returning Either<RuntimeError, (Array<Value>, Value)>
like I was thinking above, evaluate
should return (Array<Value>, Either<RuntimeError, Value>)
, allowing for output before hitting a runtime error. (First element as print output, second element as either error or top-level returned value)
Separate print functions for different types
Final implementation just has evaluate
as an impure function, not changing its type.
Add some sort of print function as a built-in to allow output beyond just the returned value.