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

Explicitly extend Base functions (Base.foo(...) = ...) instead of imports. #52

Merged
merged 5 commits into from
Apr 19, 2020

Conversation

NHDaly
Copy link
Member

@NHDaly NHDaly commented Feb 1, 2020

Explicitly extend Base functions (via Base.foo(...) = ...) instead of importing the names to be extended.

Switches to using Base: ... for non-extending imports (only for decompose).

Style consensus 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.

…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.
@NHDaly NHDaly requested a review from TotalVerb February 1, 2020 20:34
@NHDaly
Copy link
Member Author

NHDaly commented Feb 1, 2020

@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 FixedPointDecimals.cld() function instead of extending Base.cld like I meant to.

@coveralls
Copy link

coveralls commented Feb 1, 2020

Coverage Status

Coverage decreased (-0.02%) to 97.516% when pulling a2b442e on nhd-explicit-base-extending into 8e80d39 on master.

@NHDaly NHDaly force-pushed the nhd-explicit-base-extending branch from fe63195 to 317c82b Compare February 1, 2020 22:05
@codecov-io
Copy link

codecov-io commented Feb 1, 2020

Codecov Report

Merging #52 into master will increase coverage by 0.01%.
The diff coverage is 90%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/FixedPointDecimals.jl 97.77% <90%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b32b8b9...317c82b. Read the comment docs.

"""
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment has bitrotted

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than this, LGTM

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed comment. Done.

src/FixedPointDecimals.jl Outdated Show resolved Hide resolved
src/FixedPointDecimals.jl Outdated Show resolved Hide resolved
src/FixedPointDecimals.jl Show resolved Hide resolved
NHDaly and others added 3 commits April 19, 2020 12:04
Co-Authored-By: Curtis Vogt <curtis.vogt@gmail.com>
Use `using Base: @pure` instead of `Base.@pure` everywhere.

Applies @omus's PR review suggestion.
Copy link
Member Author

@NHDaly NHDaly left a 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 Show resolved Hide resolved
src/FixedPointDecimals.jl Outdated Show resolved Hide resolved
"""
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
Copy link
Member Author

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.

"""
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed comment. Done.

@NHDaly NHDaly merged commit e8c9f3b into master Apr 19, 2020
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

Successfully merging this pull request may close these issues.

5 participants