@@ -313,7 +313,7 @@ that also generates compiled code.
313
313
314
314
Other known potential failure scenarios include:
315
315
316
- 1 . Global counters (for example, for attempting to uniquely identify objects) Consider the following
316
+ 1 . Global counters (for example, for attempting to uniquely identify objects), consider the following
317
317
code snippet:
318
318
319
319
``` julia
@@ -338,12 +338,12 @@ Other known potential failure scenarios include:
338
338
future, a mechanism may be provided to register an initializer function.)
339
339
3 . Depending on compile-time side-effects persisting through load-time. Example include: modifying
340
340
arrays or other variables in other Julia modules; maintaining handles to open files or devices;
341
- storing pointers to other system resources (including memory);
341
+ storing pointers to other system resources (including memory).
342
342
4 . Creating accidental "copies" of global state from another module, by referencing it directly instead
343
343
of via its lookup path. For example, (in global scope):
344
344
345
345
``` julia
346
- # mystdout = Base.stdout #= will not work correctly, since this will copy Base.stdout into this module =#
346
+ # mystdout = Base.stdout #= will not work correctly, since this will copy Base.stdout into this module. =#
347
347
# instead use accessor functions:
348
348
getstdout () = Base. stdout #= best option =#
349
349
# or move the assignment into the runtime:
@@ -356,15 +356,15 @@ code to help the user avoid other wrong-behavior situations:
356
356
1 . Calling [ ` eval ` ] ( @ref ) to cause a side-effect in another module. This will also cause a warning to be
357
357
emitted when the incremental precompile flag is set.
358
358
2 . ` global const ` statements from local scope after ` __init__() ` has been started (see issue #12010
359
- for plans to add an error for this)
359
+ for plans to add an error for this and had been resolved by PR # 25586 ).
360
360
3 . Replacing a module is a runtime error while doing an incremental precompile.
361
361
362
362
A few other points to be aware of:
363
363
364
364
1 . No code reload / cache invalidation is performed after changes are made to the source files themselves,
365
- (including by [ ` Pkg.update ` ] , and no cleanup is done after [ ` Pkg.rm ` ]
365
+ (including by [ ` Pkg.update ` ] , and no cleanup is done after [ ` Pkg.rm ` ] .
366
366
2 . The memory sharing behavior of a reshaped array is disregarded by precompilation (each view gets
367
- its own copy)
367
+ its own copy).
368
368
3 . Expecting the filesystem to be unchanged between compile-time and runtime e.g. [ ` @__FILE__ ` ] ( @ref ) /` source_path() `
369
369
to find resources at runtime, or the BinDeps ` @checked_lib ` macro. Sometimes this is unavoidable.
370
370
However, when possible, it can be good practice to copy resources into the module at compile-time
0 commit comments