Another 0.23 heads up: imports: and initialization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Another 0.23 heads up: imports: and initialization

Herby Vojčík
Hello all!

There would be another change which could be breaking for some edge
situations.

I changed the behaviour of pacakge `imports:` clause so that the
dependency is not a load dependency any more, but a run dependency.

This means, dependencies in `imports:` are loaded lazily, once all
classes all loaded and installed; but before class-level `initialize` is
called.

This has two corollaries:

   - you can have circular `imports:`; so feel free to specify every
dependency you need to successfully _run_ your code, but which may not
actually needed to load it (refrenced classes in code, for example), and
   - you cannot presume where class-level `initialize` is run that your
dependencies are actually `initialize`d; but you can presume they are
loaded and properly organized in categories and protocols.

That's it for today.

Herby

P.S.: There is 0.22.6 out there which actually can load lazy imports:
and saves them as such, if you want to have it asap, just `npm -g
install @ambers/cli` and create new project.

P.P.S.: If you are curious how it's done, package can specify it's
"isReady" promise and the system, as of 0.22.6, waits for it before
performing initialize on the classes.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.