Closed pshc closed 7 years ago
I like this, essentially we break the print_X
methods into convert_X
and the corresponding ir:: output methods, yes?
An environment struct with scoped bindings is likely, a few pointfree functions will need that context to output properly. Also, I'd be good with moving mod ir
into its own file now, since main.rs
(as you imagine) is getting unwieldy.
If you think this can be done piecemeal, we can merge this now. Or lmk if you want to hold off after proving out the concept.
Yep, correct! Piecemeal is good. I'll go into a holding pattern and try again after we have clearer skies.
Merging. This is the right pattern to build toward and it passes tests, so 💯
Oh cool! OK. Let me push a commit to master that'll move it to a separate file.
Here's a demonstration of how we could revamp our output.
ir::Expr
enum with a few cases implementedOut
trait is a clone offmt::Display
but also threadsPrintState
vec![...]
should be broken into several lines.Once all the old String-based output is gone, we wouldn't have to pass around PrintState anymore. (Although I suspect we may end up passing around some Env struct with in-scope bindings instead...?)