You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We started out with a tree shaking in mind but we unfortunately get rid of it at one point :(
The main issue is with circular imports - they are commonplace in erlang but strictly forbidden in purescript :(
In Erlang you can have a function in module A calling a function in module B calling a function in module A.
To work around it remote calls are being dispatched dynamically via a code server - https://github.com/erlscripten/erlps-core/blob/2be641733d1179a6198835f917c3d3cbbc820712/es6/ffi_es6_builtins.js#L998
This unfortunately is not optimal and incurs a performance penalty - the upside is that this allows us to match erlang's semantics closely and weird OTP stuff like on_load callbacks or hot code reloading are feasible to implement.
@radrow ES6 modules allow for circular imports - let's investigate whether we can make tree shaking working :)
purescript
planning to introduce it in the next major release: purescript/purescript#3613Until that we can try to rewrite
require
/module.exports
by ourselves this way: https://github.com/jameswomack/replace-require-with-import/blob/master/index.jsAlso, would be nice to import not the whole file, but only used parts, like
instead of
Tree shaking should significantly reduce the amount of imported code if the user needs one specific function, not the whole compiler.
The text was updated successfully, but these errors were encountered: