Closed GiggleLiu closed 2 years ago
I think this would be the solution to your feature without adding a new syntax to the package https://github.com/johnnychen94/LazyModules.jl
cc: @johnnychen94
For CUDA.jl it will almost certainly hit the world-age issue because CuArray
is an alien type to the caller world-age. See the discussion in [ANN] Accouncing LazyModules.jl: delay the heavy dependency loading to its first use
OK, that's quite unfortunate... but in general, I feel this is not something Comonicon should support but should be supported by Julia itself unless we can find a way that does not change the syntax.
If I want to write a script with both GPU and CPU code, then I can avoid using CUDA by using the following grammar.
The
@main
macro calls the required using statement by inspectingARG[1]
.