gleam
gleam copied to clipboard
Draft: Improvements to typescript codegen
Interesting, I wonder what happened here. Perhaps we broke something...
Do you have more you want to do here or should I review thoroughly?
The implementation is not really solid, and the changes I made should be reflected in function names and so on. I created the tests and basically brute forced a fix that did not break anything else, but I don't trust my reasoning enough to say this is an improvement...
Another thing that made it difficult for me was the compile + exec flow of rust, and the rust language itself. I would love if it was possible to build this typescript translation in gleam, not rust :D
Me too! Unfortunately I think we are a long way away from being able to write native Gleam code and link it from the compiler
Me too! Unfortunately I think we are a long way away from being able to write native Gleam code and link it from the compiler
A wild thought, but I think there should be a Gleam interpreter written in Rust - this same interpreter would allow const-evaluated functions
const fn double(a) {a *2}
const abc = double(123)
And then, for some parts of the compiler where performance is not deemed important, as in TS codegen, it'd be written in Gleam.
An interpreter would be very handy!
I would consider anything in the compile loop (such as TS generation) to be something where we care about performance a lot so it'd need to be fast in that instance. Could be useful for various tooling commands though.
Another option could be to start a long lived instance of the VM that we can send jobs to over the network.
Such an interpreter could also then be used for a REPL?
It could, though we wouldn't be able to do anything that involves FFI
Is this ready to review? Thanks
Is this ready to review? Thanks
For now I fear I won't be able to improve the MR, so it is ready for review.