You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into some issues using this package alongside another macro-based package, ProgressLogging.jl
My goal is to add optional progress bars to a package which uses ResumableFunctions.jl, the original function definition looks straightforward, for example
@resumablefunctionf1(x)
for xi in x
@yield xi
endend
which compiles and operates perfectly as expected.
The first attempt at progress logging, using the @progress macro fails already due to the rewriting:
@resumablefunctionf2(x)
@progressfor xi in x
@yield xi
endend
ERROR: LoadError: LoadError:@progress requires a for loop (for i in irange, j in jrange, ...; <body>end) or array comprehension with assignment (x = [<body>for i in irange, j in jrange, ...])
okay, that's fine, let's try the more flexible approach using @withprogress
@resumablefunctionf2(x)
@withprogressbegin
i =1; N =length(x)
for xi in x
@yield xi
@logprogress i/N
i +=1endendend
ERROR: syntax: cannot goto label "_STATE_1" inside try/catch block
so in both cases, something is clashing between the two macros. I tried looking into the source code, both here and the code produced by @macroexpand but it's so complicated I can't gleam any information from it.
version info:
julia>versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb* (2021-03-2412:55 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin20.3.0)
CPU:Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
WORD_SIZE:64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_PKG_DEVDIR =/Users/miles/dev/julia
JULIA_NUM_THREADS =4
pkg> st --manifest
Status `/private/var/folders/g2/n_lg14f56k776c2p35gktr000000gn/T/jl_8WDmZ0/Manifest.toml`
[1914dd2f] MacroTools v0.5.6
[33c8b6b6] ProgressLogging v0.1.4
[c5292f4c] ResumableFunctions v0.6.0
[2a0f44e3] Base64
[56ddb016] Logging
[d6f4376e] Markdown
[9a3f8284] Random
[ea8e919c] SHA
[9e88b42a] Serialization
[cf7118a7] UUIDs
The text was updated successfully, but these errors were encountered:
If I'm not mistaken, in the first attempt, it fails because @resumable takes for loops and converts them into a while loop. In the second attempt, nested @yield tend to fail with ResumableFunctions.jl. @resumable must be converting the begin block into some try/catch.
I agree, not much can be gleaned from the source code in this package.
I'm running into some issues using this package alongside another macro-based package, ProgressLogging.jl
My goal is to add optional progress bars to a package which uses ResumableFunctions.jl, the original function definition looks straightforward, for example
which compiles and operates perfectly as expected.
The first attempt at progress logging, using the
@progress
macro fails already due to the rewriting:okay, that's fine, let's try the more flexible approach using
@withprogress
so in both cases, something is clashing between the two macros. I tried looking into the source code, both here and the code produced by
@macroexpand
but it's so complicated I can't gleam any information from it.version info:
The text was updated successfully, but these errors were encountered: