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

LoadError when yielding tuple with field name identical to local variable name #32

Open
marc-hofmann opened this issue Dec 17, 2018 · 2 comments

Comments

@marc-hofmann
Copy link

The following

@resumable function my_generator()
    x = 0
    @yield (x = 1, )
end

fails with

ERROR: LoadError: syntax: invalid named tuple field name "_fsmi.x"

No error is raised if the field name is changed:

@resumable function my_generator()
    x = 0
    @yield (y = 1, )
end

Julia 1.0.2, ResumableFunctions 0.4.2

@BenLauwens
Copy link
Collaborator

Hi

Error is logical. The symbol x is the name of a slot in the method and all symbols x are replaced by _fsmi.x to transform the function in a state machine. I will try to bypass this general rule for named tuples. I keep you informed of progress!

Kind regards

Ben

@marc-hofmann
Copy link
Author

Hi, Ben

Thank you for the explanation.

Best,
Marc

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