bootstrap_graaljs.js missing in graaljs builds


The cljs/bootstrap_graaljs.js file provides some basic functions like setTimeout which libraries take as given in a JS environment to work.

For GraalJS repl envs this is provided:

For optimized builds however, the file is not included and the functions are missing:






Dieter Komendera
June 18, 2019, 11:48 AM would have been my first approach: It adds the bootstrap_graaljs.js file to inputs. This works for :optimiziations :simple, but not for :advanced. I this could probably be fixed with externs, but wanted to discuss the general approach first.

Mike Fikes
August 5, 2019, 11:18 PM

Yeah, in general, this makes sense to me: We have precedent with Node with respect to the notion of target-specific "support libs".

Perhaps a slight improvement would be to separate out the general runtime support functions (setTimeout etc.) into a separate GraalJS runtime support file, which :simple / :advanced builds could implicitly load along the lines that you suggest. (These could be separated out from those functions that really only exist to help bootstrap GraalJS in a mode supporting REPL development, loading using Closure infrastructure---those functions might not need to be there in :simple / :advanced builds.)

With respect to :advanced and externs: Functions like setTimeout may already be covered and, assuming the "support lib" is essentially treated as a foreign lib, not passed through Closure, Closure would know not to rename call call sites that go through Closure.

Dieter Komendera
August 19, 2019, 6:50 PM

Thanks for your feedback Mike! I looked into advanced compilation, and the problem is not missing externs for setTimeout etc, but for the Java methods used: newScheduledThreadPool etc. As with the current patch, it thus seems the support lib is not treated as a foreign lib. I tried to figure out a way to treat it like a foreign lib, but did not succeed thus far. I’ll have another try, but in the meantime if somebody has a pointer on how to do that, that would help a lot.

Dieter Komendera
April 6, 2020, 3:04 PM

This also can be closed since out of the box graaljs support has been removed ClojureScript compiler.

Won't Fix


Dieter Komendera


Dieter Komendera