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

arc and carc argument list varies #184

Closed
hustf opened this issue Dec 6, 2021 · 5 comments
Closed

arc and carc argument list varies #184

hustf opened this issue Dec 6, 2021 · 5 comments
Labels

Comments

@hustf
Copy link
Contributor

hustf commented Dec 6, 2021

Quite minor, quite unexpected bug popped up today. Perhaps a good first PR?

To reproduce:

(r, β_sta, β_cutoff) = (43.5, -1.57, -4.99)
carc(0, 0, r,  β_sta, β_cutoff, :stroke)
# Workaround:
arc(0, 0, r, β_sta, β_cutoff, action = :stroke)
# This does not work:
arc(0, 0, r, β_sta, β_cutoff, :stroke)
ERROR: MethodError: no method matching arc(::Int64, ::Int64, ::Float64, ::Float64, ::Float64, ::Symbol)
Closest candidates are:
  arc(::Any, ::Any, ::Any, ::Any, ::Any; action) at C:\Users\f\.julia\packages\Luxor\rOUAt\src\curves.jl:167
  arc(::Point, ::Any, ::Any, ::Any; action) at C:\Users\f\.julia\packages\Luxor\rOUAt\src\curves.jl:182
  arc(::Point, ::Any, ::Any, ::Any, ::Symbol) at C:\Users\f\.julia\packages\Luxor\rOUAt\src\curves.jl:185
Stacktrace:
 [1] top-level scope
   @ REPL[13]:1

Edit: The line '#This does not work' is corrected. NOW it is not working...

@cormullion
Copy link
Member

Thanks. I wonder if this is a bug introduced in the current release after I tried to “fix” #174. When I’m at a computer I’ll investigate previous releases.

@cormullion
Copy link
Member

Yes, I think that's a regression:

arc(0, 0, r, β_sta, β_cutoff, :stroke)

used to work in Luxor 2.15, but after I added all the action=:stroke methods the old arc(x, y, ... method is too ambiguous to resolve and needs another method to handle it. (But arc(Point, ... action=:stroke works OK.)

I'm thinking about taking all the old (x, y... methods away, keeping just the (Point, ... versions, so that you'd do arc(Point(x, y), ... instead of arc(x, y, ... but that might be a breaking change for version 3.0... :)

@cormullion cormullion added the bug label Dec 7, 2021
@hustf
Copy link
Contributor Author

hustf commented Dec 7, 2021

I don't see the point in public (x, y..) methods either, but ´x´ is clearer to read than pt[1]. Perhaps keeping all these methods might cause fewer bugs during the transition - just head them up underscore: e.g. _arc(x,y...

We have these largely unnecessary action arguments, too. How about trying something like this out with the arc function?

@deprecate( arc(pt, r, β_sta, β_cutoff, action::Symbol),     
                     arc(pt::Point, r, β_sta, β_cutoff; action = replace), 
                     true)

I haven't tested the syntax, but the last argument means that the deprecation warnings won't be shy.
If this works as intended, we could have an effective mass exodus of ::Symbol as the last argument in all of this package? Personally, I would hope for action = :stroke as the default everywhere.

Then, in v3.0, simply delete all of the @deprecate lines?

@cormullion
Copy link
Member

Yes, these are logical changes to make, of course. But I always wonder whether disruption is worth the improvement - eg for Julia 2.0 I hope we don't see too many changes that are like "this is a bit untidy, let's remove it/make it more consistent". 😃

@hustf
Copy link
Contributor Author

hustf commented Dec 7, 2021

Long term vs short term I guess. In the very long run, there will be other packages like this, perhaps when Cairo is replaced. This is working very well for me now, but font sizing not working at the moment is not so nice.

@hustf hustf closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants