Skip to content
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

@resumable functions do not support where type specifications #3

Closed
gasagna opened this issue Oct 9, 2017 · 5 comments
Closed

@resumable functions do not support where type specifications #3

gasagna opened this issue Oct 9, 2017 · 5 comments

Comments

@gasagna
Copy link

gasagna commented Oct 9, 2017

This code

using ResumableFunctions

f(x) = 0.5*x*(x-1)

@resumable function foo(x::T) where {T}
    for i = 1:10
        @yield x
        x = f(x)
    end
    x
end

results in

ERROR: LoadError: UndefVarError: T not defined
Stacktrace:
 [1] include_from_node1(::String) at ./loading.jl:576
 [2] include(::String) at ./sysimg.jl:14
 [3] process_options(::Base.JLOptions) at ./client.jl:305
 [4] _start() at ./client.jl:371
while loading ../tests.jl, in expression starting on line 32

This issue is not blocking openjournals/joss-reviews#400 to be accepted, but at least it should be mentioned in the caveats. In the long term, supporting where type specifications would be a very useful feature to have.

@gasagna gasagna changed the title @resumable function do not supports where type specifications @resumable functions do not support where type specifications Oct 9, 2017
@gasagna
Copy link
Author

gasagna commented Oct 9, 2017

I now see in the readme that parametric resumable functions are not currently supported. Apologies. This could go in the docs as well. How hard is to implement this functionality?

@BenLauwens
Copy link
Collaborator

I am waiting for a new release of Macrotools to implement this functionality. I have only to change the type definition and the constructor but this is fairly trivial once where is completely supported in Macrotools. I have added a todo section to the docs.

@BenLauwens
Copy link
Collaborator

Parametric resumable functions are available now in the master branch. Further testing is however needed.

@BenLauwens
Copy link
Collaborator

Feature is working and all tests are successful. When the docs are updated, I will do a new release and close this issue.

@BenLauwens
Copy link
Collaborator

Feature supported in v0.1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants