When does `@ static` start?

@static expr- this is a way to only run expronce; for some reason once.
but what's the point once it?

It:

  • once during the time when the package is installed?
  • once during the time when the package is downloaded?
  • some other definition

The most common use for checking the OS: for example. ccall((@static Sys.iswindows() ? :_fopen : :fopen), ...)

I am wondering if I can use it to generate other code based on an environment variable: in particular JULIA_NUM_THREADS. This environment variable may change between julia cycles, but if it changes during a session, nothing will respond to it.

+6
source share
1 answer

( , ). ( ), (.. "INFO: Precompiling module..." ).

, , __precompile__(false) ( ).

+2

All Articles