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

splitarg incompatible with kwargs on 1.7 #177

Closed
willow-ahrens opened this issue Dec 30, 2021 · 6 comments
Closed

splitarg incompatible with kwargs on 1.7 #177

willow-ahrens opened this issue Dec 30, 2021 · 6 comments

Comments

@willow-ahrens
Copy link
Contributor

willow-ahrens commented Dec 30, 2021

Therefore, it is no longer safe to do funcdef[:kwargs] = map(arg->combinearg(splitarg(arg)...), funcdef[:kwargs], since this would transform a definition like f(;kwargs...) to f(;kwargs::Any...) which is no longer allowed in Julia 1.7. I don't know why that's no longer allowed, but from the REPL:

ERROR: syntax: "x::Any" is not a valid function argument name around REPL[3]:1
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1
@cstjean
Copy link
Collaborator

cstjean commented Jan 1, 2022

MWE, for convenience:

julia> f(args::Any...) = 10
f (generic function with 2 methods)

julia> f(;args::Any...) = 10
ERROR: syntax: "args::Any" is not a valid function argument name around REPL[24]:1
Stacktrace:
 [1] top-level scope
   @ REPL[24]:1

Man, that sucks.

First things first, can we identify the Julia PR that changed this? I'm not sure that this isn't simply an unintended change, that could potentially be reverted in a julia patch release.

Second... There's another solution, being that IF slurp is true AND type is :Any, THEN do not output the type. It's not pretty, but I find it hard to believe that it'll break anybody's code...

@cstjean
Copy link
Collaborator

cstjean commented Jan 1, 2022

JuliaLang/julia#43625. The more I think about it, the more I believe that this was unintended. The error message certainly doesn't sound like a carefully thought deprecation!

@willow-ahrens
Copy link
Contributor Author

willow-ahrens commented Jan 1, 2022

I'm not sure it's even possible for the symbol :Any to evaluate to anything other than Any, so I think it's always correct to omit a typassert on :Any. I've updated #178 accordingly.

@cstjean
Copy link
Collaborator

cstjean commented Jan 1, 2022

Let's wait for Julia's feedback. Julia 1.7 introduced a special case (all args can be typed except...), which forces us to introduce another special-case, which might well force other libraries downstream to special-case Any too. It's not a good situation at all.

@cstjean
Copy link
Collaborator

cstjean commented Jan 4, 2022

Update from JuliaLang/julia#43625: Jeff said that the new behaviour wasn't exactly intentional, but that it's in a sense more correct than the old, so we'll go ahead with #178

@willow-ahrens
Copy link
Contributor Author

This is fixed by #178 and a better, additional, solution is described in #179

@cstjean cstjean closed this as completed Jan 5, 2022
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