Open isaacharrisholt opened 3 months ago
We just need to add the compiled Erlang stdlib to the bundle like we do with the JS stdlib in order to get compilation working.
It's not possible to execute Erlang in a browser so this isn't needed!
Agreed we should execute the JS target, but it would be nice to show the compiled Erlang output, no?
Yes but you don't need to add compiled Erlang stdlib to the bundle to do that. The only thing you need to do is ask the compiler for Erlang rather than JavaScript and it'll just work.
I tried doing that but it complained about missing libraries
Here's the specific error:
error: Function without an implementation
┌─ /src/gleam/float.gleam:72:1
│
72 │ fn do_round(a: Float) -> Int
│ ^^^^^^^^^^^^^^^^^^^^^
We can't compile this function as it doesn't have an
implementation. Add a body or an external implementation
using the `@external` attribute.
That's due to your code removing the Erlang externals here: https://github.com/gleam-lang/playground/pull/1/files#diff-0065b9cdf8ba089285f3fbb25a377340d06c0259d93e36ef05c7c908ea950b71R195-R197
Welp. Sounds about right. That'll teach me for copy-pasting stuff and then not reading it in detail 😅
Thanks! I'll add this to #1.
The code for this is mostly there on the JS side (in
index.js
andworker.js
). We just need to add the compiled Erlang stdlib to the bundle like we do with the JS stdlib in order to get compilation working.