-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fixes 165, Fixes 177. #178
Fixes 165, Fixes 177. #178
Conversation
Codecov Report
@@ Coverage Diff @@
## master #178 +/- ##
==========================================
+ Coverage 73.56% 74.68% +1.12%
==========================================
Files 9 9
Lines 401 403 +2
==========================================
+ Hits 295 301 +6
+ Misses 106 102 -4
Continue to review full report at Codecov.
|
That's a really nice PR, thanks!
👍 It's an improvement.
Yes, that's unfortunately thorny. I don't see a way out of that change... While we're at it, I wonder if we shouldn't return a namedtuple from both Also makes me want to reconsider #132... Now that MacroTools isn't super actively developed, maybe it'd make sense? EDIT: Looking at ExprTools, it's still missing |
In any case, I'd like to think about it a bit before suggesting a particular change, but I agree that one set of breaking changes (and associated version bump, if necessary) is better than multiple ones, so we need to think well about the interface that's best... |
Yes, let's think about it, but not for too long. A library like MacroTools is more useful when it can keep up to date with the syntax changes of Julia as they happen. If this issue takes two years to resolve, like #132 has, users are probably better off just writing their own splitarg as a utility file in their package and keeping it up to date themselves. If a discussion on the Julia Discourse or the Julia Slack would help everyone feel more confident about an interface change, let's start one. I agree that the We would get the same benefits of being able to call Let me know if you'd like me to update this PR to return |
Since there are many users of MacroTools, and we're concerned about making a breaking change, we could also deprecate |
True. Arrr, I don't know. You make a good point re. type stability. Here's another proposal, which I hate for its complexity, but it kinda fills a lot of desiderata. Return a struct like: mutable struct SplitArg
name::Some
type::Some
default::Some
splat::Bool
end That would be type stable, and incur no particular compile-time cost. Then implement In the short term, we could keep supporting 🤮 I really don't like it. I'm kinda worried about making a breaking release. How long does it take for all of these packages to upgrade to the latest version? I guess it's fine with
Not a bad idea, could you please start it? Basically, is it worth the transition pain making a point release when there is such a small interface change to a not-so-frequently used portion of MacroTools, given that it's so ubiquitous? |
Yeah, I really like the simplicity of the Dict interface. A tuple of Also, we could sneakily have both |
I suspect that solutions which attempt to preserve the old interface (fancy Therefore, I advocate for the introduction of new functions named I don't think there's a way to get around the fact that users of |
A discourse post was made here. |
I finally had some time to download Julia 1.7 and check this out. I don't understand the default = nothing problem. julia> fdef = :(foo(; x=1, y=nothing) = 2);
julia> splitdef(fdef)[:kwargs][2]
:($(Expr(:kw, :y, :nothing)))
julia> splitarg(splitdef(fdef)[:kwargs][2])
(:y, :Any, false, :nothing) That looks fine to me. Where's the problem? Could you provide a broken test example? |
My original post referenced the wrong issue when I intended to reference #35 (where the
|
More specifically, here are the two places where this is discussed in most detail: |
An arguably less rare issue with |
I've updated this PR to the minimal change suggested in #177, but I still think a dictionary-based interface would be nice to add under a separate name, perhaps in a separate PR. |
I like it too, but I agree with what Kristoffer said: we should try our best to avoid the need for a breaking release. Maybe if/when it's time for
Yeah... That's a gotcha, but it's not really a bug. You can just pass a |
Yes, and then the |
A thought, we could wrap literal |
If the API gets a breaking change, then isn't that by definition the time to up the version to 0.6? I.e. if this PR is merged then (as I understand the discussion) this would need to happen? |
The PR has been updated since it was first submitted. The new plan is that if |
I suspect that changing the output of |
julia> let Any=Int
Any
end
Int64 🤔 It's very unlikely that someone will do something like that though, so we'll just leave it at that. But it's another argument for the Dict output.... One day... |
Co-authored-by: Cédric St-Jean <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these changes, it should be good to merge.
Co-authored-by: Cédric St-Jean <[email protected]>
Co-authored-by: Cédric St-Jean <[email protected]>
I think this one's ready to merge. |
Thanks! |
A partial rewrite of splitarg and combinearg to fix #165 and #177.
The big change here is that
arg_type
can benothing
if no type is declared for an argument. I know that this is a change to the interface, but I also see no other way to fix the problem. While we are changing the interface, we may want to consider handling literalnothing
as an argument default through the baseSome
andsomething
interface. (discussed in #35).