johnnychen94 / LazyModules.jl

No, no, not now
MIT License
21 stars 2 forks source link

Add `@require` functionality #1

Closed CarloLucibello closed 2 years ago

CarloLucibello commented 2 years ago

See https://discourse.julialang.org/t/ann-accouncing-lazymodules-jl-delay-the-heavy-dependency-loading-to-its-first-use/80890/4?u=carlolucibello for a description

johnnychen94 commented 2 years ago

I replied in the same thread. I'm not convinced that this is a needed feature so don't plan to implement it here.

CarloLucibello commented 2 years ago

I still think that

@require import SomePkg

would be a good fit for this pkg, providing an alternative to @lazy that is useful in cases where @lazy incurs in world-age issues due to the returned types. With this addition, LazyModules.jl and Requires.jl would cover the full spectrum of possibilities.

johnnychen94 commented 2 years ago

I haven't seen this pattern used elsewhere, so how about you adopt the function version first in MLDatasets and see how that works?

The @lazy import pattern is used in FileIO and ImageIO for quite a long time so I'm confident that this is useful. -- but I'm not very sure of the @require pattern. -- I'm not confident that people will like the "to use this feature, do using Foo before" experience, we need time to test it and see how people feel.