-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem Using @isdefined
Inside a @resumable
Function
#119
Comments
Thanks for flagging this! The
And the
Given that ResumableFunctions's premise is to take a function and chop it up and convert it into a finite state machine, this type of Julia built-ins would need to be reimplemented from scratch. If someone wants to give that a try, PRs are welcomed! But I do not believe any of the current maintainers plan to work on this in the future as More generally, macros, even less invasive macros than this one, do not work too well in resumable functions from this library. See #54 and #104. These issues might be addressed sooner though. |
I don't see how this could be made work with the current approach. I think |
Indeed, just added it here 3e944f3 For now I am marking it as I am also marking it as |
Thanks for the quick response. I have a workaround using an initial value of `nothing`.
On Dec 6, 2024 11:21 AM, Stefan Krastanov ***@***.***> wrote:
Indeed, just added it here 3e944f3<3e944f3>
For now I am marking it as wontfix as there isn't anyone I know that plans to tackle it.
I am also marking it as error messages -- as OP mentioned, the error messages related to this can be better.
—
Reply to this email directly, view it on GitHub<#119 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIBY3E7OLVGKNKPETURARXD2EHFHVAVCNFSM6AAAAABTETL5XSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTGY3DCNZUGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I'm having a problem using
@isdefined
inside a@resumable
function (https://github.com/JuliaDynamics/ResumableFunctions.jl).
works, but
gets the error
When I try to macroexpand the same definition I get the same
error.
@macroexpand @Resumable function foo(x)
local y
y
end
using MacroTools
prewalk(rmlines,
@macroexpand @Resumable function foo(x)
local y
y
end
)
quote
mutable struct var"##foo_FSMI#307"{var"##y#308" <: Any, var"##x#309" <: Any} <: ResumableFunctions.FiniteStateMachineIterator{Any}
_state::UInt8
y::var"##y#308"
x::var"##x#309"
function var"##foo_FSMI#307"{var"##y#308", var"##x#309"}(; ) where {var"##y#308" <: Any, var"##x#309" <: Any}
fsmi = new()
fsmi._state = 0x00
fsmi
end
function var"##foo_FSMI#307"(; )
var"##foo_FSMI#307"{Any, Any}()
end
end
function (_fsmi::var"##foo_FSMI#307")(_arg::Any = nothing; )
_fsmi._state === 0x00 && $(Expr(:symbolicgoto, :_STATE_0))
error("@Resumable function has stopped!")
$(Expr(:symboliclabel, :_STATE_0))
_fsmi._state = 0xff
_arg isa Exception && throw(_arg)
local _fsmi.y
_fsmi.y
end
begin
$(Expr(:meta, :doc))
function foo(x::Any; )
fsmi = ResumableFunctions.typed_fsmi(var"##foo_FSMI#307", var"##306", x)
fsmi.x = x
fsmi
end
end
end
The text was updated successfully, but these errors were encountered: