Closed maxsnew closed 1 year ago
Oh I can only ask for one reviewer at a time. But I want to alert everyone who works close to this part to the change @LighghtEeloo @SchwarzXia @ricky136973
Just checked, LGTM. Looking forward to completing #8 inside zydeco as much as possible.
Pre-considering more general use cases:
panic!
at runtime it is fine, but can we do better and lift this error to compile time?PrimComp
s pure; actually, it's a problem of expressing effects and the ability and inability to use them on a specific instance of some platform, which is essentially the same problem as that in question 1. So should we classify the PrimComp
s by the effects they require? Algebraic effects should do the trick, but I'm not sure how hard it is to support (as a library or builtin) or how much we desire such feature.On my side, if the questions above are responded, I think we are good to go. What do you guys think?
Let's take the discussion of "more general use cases" somewhere else (like slack).
(Implements #24)
This does two main things:
Ann
s everywhere in the evaluator. I just found these completely pointless and difficult to keep track of.input: &mut dyn BufRead
andoutput: &mut dyn Write
to the runtime state and changing the evaluator to returnResult<ZValue, Exit>
whereExit
is either an error or an early exit with an exit code. This also required minor changes to the implementations of the builtin functions.I then also updated
zydeco.rs
to instantiate this abstract effect interface twice: once with the originalOS
primitives and once with basically empty input/output streams, and updated the builtin functions to use the new types. This also makes it possible to mock I/O and observe exit codes so we can implement #8 easily.