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

stagedfunctions don't work with default arguments #9088

Closed
timholy opened this issue Nov 21, 2014 · 2 comments
Closed

stagedfunctions don't work with default arguments #9088

timholy opened this issue Nov 21, 2014 · 2 comments

Comments

@timholy
Copy link
Sponsor Member

timholy commented Nov 21, 2014

Another not-urgent thing that needs fixing with stagedfunctions:

julia> stagedfunction myfunc(x, a = 5)
           @show x, a
           :(x + a)
       end
myfunc (generic function with 2 methods)

julia> myfunc(7)
(x,a) = (Type{Int64},Int64)
ERROR: `+` has no method matching +(::Type{Int64}, ::Int64)
 in anonymous at no file
 in myfunc at none:2

Presumably we should either disable default arguments, or (better) substitute in the type of the default rather than its value during instantiation.

@JeffBezanson
Copy link
Sponsor Member

I would say the fix is to make the one argument definition not staged.

@simonster simonster changed the title stagefunctions don't work with default arguments stagedfunctions don't work with default arguments Nov 21, 2014
@timholy
Copy link
Sponsor Member Author

timholy commented Nov 21, 2014

Thanks, Jeff!

bjarthur pushed a commit to bjarthur/julia that referenced this issue Nov 21, 2014
when multiple methods (for keyword or default args) are generated,
only the one with the original code should be staged.
waTeim pushed a commit to waTeim/julia that referenced this issue Nov 23, 2014
when multiple methods (for keyword or default args) are generated,
only the one with the original code should be staged.
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