The problem here was that both ProgressMeter and TaylorSeries export update!, so we had to use import instead of using for one of those packages.
Since we use ProgressMeter.update! but not TaylorSeries.update!, I thought that we should use import TaylorSeries and explicitly add the functions from TaylorSeries that we use.
While trying this, I discovered an issue with Requires which I want to share here.
TaylorSeries also exports normalize_taylor, but that function only becomes visible after loading IntervalArithmetic via Requires. This can be seen as follows:
julia> using TaylorSeries
julia> normalize_taylor
ERROR: UndefVarError: normalize_taylor not defined
julia> import IntervalArithmetic
julia> normalize_taylor
normalize_taylor (generic function with 4 methods)
So I tried the following in Reachability:
julia> import IntervalArithmetic, TaylorSeries
julia> using TaylorSeries: normalize_taylor, ...
While this works perfectly in the REPL, loading this from within a module crashes in the precompilation. The reason is that Requires defers the loading to a queue and processes that queue only after the current command. Since "the current command" here is "precompile the module", the precompilation must finish before the extra code is loaded. And this means that TaylorSeries.normalize_taylor is not visible at that time. (This can be tested by adding a print output to the @require command in TaylorSeries.)
So I ended up with import ProgressMeter and writing ProgressMeter.update! everywhere. Note that ultimately there is no way around this and using MyPackage is only a convenience functionality to avoid spelling out the package in most cases.
Closes #632.
The problem here was that both
ProgressMeter
andTaylorSeries
exportupdate!
, so we had to useimport
instead ofusing
for one of those packages.Since we use
ProgressMeter.update!
but notTaylorSeries.update!
, I thought that we should useimport TaylorSeries
and explicitly add the functions fromTaylorSeries
that we use. While trying this, I discovered an issue withRequires
which I want to share here.TaylorSeries
also exportsnormalize_taylor
, but that function only becomes visible after loadingIntervalArithmetic
viaRequires
. This can be seen as follows:So I tried the following in
Reachability
:While this works perfectly in the REPL, loading this from within a module crashes in the precompilation. The reason is that
Requires
defers the loading to a queue and processes that queue only after the current command. Since "the current command" here is "precompile the module", the precompilation must finish before the extra code is loaded. And this means thatTaylorSeries.normalize_taylor
is not visible at that time. (This can be tested by adding a print output to the@require
command inTaylorSeries
.)So I ended up with
import ProgressMeter
and writingProgressMeter.update!
everywhere. Note that ultimately there is no way around this andusing MyPackage
is only a convenience functionality to avoid spelling out the package in most cases.