top | item 45474299

(no title)

hhthrowaway1230 | 4 months ago

doesn't this make the language a little unpredictable in terms of loading times? requiring to touch all parts to fully load the app?

discuss

order

amdsn|4 months ago

I think a feature like this sees best use in short lived programs (where startup time is a disproportionate percentage of total run time) and programs where really fast startup is essential. There are plenty of places where I could imagine taking advantage of this in my code at work immediately, but I share your concern about unpredictability when libraries we use are also making use of it. It wouldn't be fun to have to dive into dependencies to see what needs to be touched to trigger lazy imports at the most convenient time. Unless I am misunderstanding and a normal import of a module means that all of its lazy imports also become non-lazy?