-
Notifications
You must be signed in to change notification settings - Fork 22
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
Explicitly extend Base functions (Base.foo(...) = ...) instead of imports. #52
Conversation
…orts. Style concensus seems to be that extending via `imports` should be discouraged since it can lead to both accidentally extending functions, and accidentally _not_ extending the intended functions. This is a style-only change; there should be no substantive change at all.
@TotalVerb I opened this as a follow-up to the last PR (#51), since i accidentally messed up at first by creating a new, local |
fe63195
to
317c82b
Compare
Codecov Report
@@ Coverage Diff @@
## master #52 +/- ##
==========================================
+ Coverage 97.76% 97.77% +0.01%
==========================================
Files 1 1
Lines 179 180 +1
==========================================
+ Hits 175 176 +1
Misses 4 4
Continue to review full report at Codecov.
|
src/FixedPointDecimals.jl
Outdated
""" | ||
Base.@pure function max_exp10(::Type{T}) where {T <: Integer} | ||
function max_exp10(::Type{T}) where {T <: Integer} | ||
# This function is marked as `Base.@pure`. Even though it does call some generic |
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.
comment has bitrotted
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.
other than this, LGTM
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.
Oops. I don't think i actually meant for this change to be part of this PR... BUT i guess it doesn't hurt. It is definitely an improvement, so i'll just carry it along. Sorry about that; thanks for the careful review.
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.
Fixed comment. Done.
Co-Authored-By: Curtis Vogt <curtis.vogt@gmail.com>
Use `using Base: @pure` instead of `Base.@pure` everywhere. Applies @omus's PR review suggestion.
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.
Thanks both for the review. :) Haha sorry for my long delays between work here and thanks again :)
I'll go ahead and merge now.
src/FixedPointDecimals.jl
Outdated
""" | ||
Base.@pure function max_exp10(::Type{T}) where {T <: Integer} | ||
function max_exp10(::Type{T}) where {T <: Integer} | ||
# This function is marked as `Base.@pure`. Even though it does call some generic |
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.
Oops. I don't think i actually meant for this change to be part of this PR... BUT i guess it doesn't hurt. It is definitely an improvement, so i'll just carry it along. Sorry about that; thanks for the careful review.
src/FixedPointDecimals.jl
Outdated
""" | ||
Base.@pure function max_exp10(::Type{T}) where {T <: Integer} | ||
function max_exp10(::Type{T}) where {T <: Integer} | ||
# This function is marked as `Base.@pure`. Even though it does call some generic |
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.
Fixed comment. Done.
Explicitly extend Base functions (via
Base.foo(...) = ...
) instead of importing the names to be extended.Switches to
using Base: ...
for non-extending imports (only fordecompose
).Style consensus seems to be that extending via
imports
should bediscouraged since it can lead to both accidentally extending functions,
and accidentally not extending the intended functions.
This is a style-only change; there should be no substantive change at all.