Treat Temporal as a JS global
Why
A binding printed as Temporal hides the global Temporal in its scope. The bindings of the next commit are externals with dotted names like "Temporal.PlainDate.from", which are printed as written: unlike @scope externals (#8785), they are not read through globalThis when a binding of the same name is in scope. A module named Temporal next to a call of the bindings would then be called instead.
modifiedJS module named Temporal
type instant@val external now: unit => instant = "Temporal.Now.instant" module Temporal = { let zone = "UTC"} let stamp = () => now()
js
Review
- Why not read dotted externals through
globalThisinstead? That changes every dotted external, not only Temporal's. A reserved name is howIntland the other built-ins are handled, and it also keeps raw JavaScript next to the module reading the global. The next commit tests it inStdlib_TemporalTests.