-
Notifications
You must be signed in to change notification settings - Fork 71
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
Renaming of functions #572
Renaming of functions #572
Conversation
Two comments:
|
The typical corner case that requires to disallow function diffexp(x, y)
if x == y
return 1
else
return exp(x - y)
end
end Keeping |
Yep ok that's fair; let's have as many alarm bells as possible! |
86fd153
to
1ca9930
Compare
@Kolaru have you any feedback on this PR? |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #572 +/- ##
==========================================
- Coverage 85.91% 85.74% -0.18%
==========================================
Files 29 29
Lines 1640 1648 +8
==========================================
+ Hits 1409 1413 +4
- Misses 231 235 +4
☔ View full report in Codecov by Sentry. |
The renaming need to be discussed separately from the removal of I therefore suggest to open another PR with only the [*] A concept I just invented to avoid saying it is a number ^^' |
9d3d938
to
8ddfa83
Compare
Following the triage call, this PR is only about changing the function names to resolve the confusion induced by overloading Here are the only function with name changes:
Should fix #409. We could also address the bug reported in #219 and #419 in this PR, what do you think? |
We discussed it in the call today and realized the renaming has a deeper meaning. Namely, the idea is to "unsupport" intervals as 1 element arrays. This is the default for julia> intersect(2, 3)
Int64[]
julia> intersect(34, 34.0)
1-element Vector{Float64}:
34.0 This is a problem for us because intersection of intervals, and intersection of 1 element arrays containing an interval are different. By disallowing both, we avoid silent ambiguity that can lead to incorrect behaviors. Thus I am in favor of the renaming. What the name should be is not so clear. I am fine with the name proposed. A possible alternative (possibly more elegant) would be to add a singleton to tell how the set operation should be understood. For example struct IntervalAsSet end
intersect(::IntervalAsSet, x::Interval, y::Interval) That way we keep |
I have added explicit error messages for We can do the same for set operations to disambiguate, namely |
In the last commit I removed
|
d282785
to
c7d9725
Compare
Only one small think: wouldn't it be more consistent to have all
I don't have a definitive opinion on that. I think either way, this PR can be merged now. |
So here are the name changes:
Note 1: array operations Note 2: I did not rename Note 3: Do not hesitate if you have more suggestions. |
IntervalBox
is a wrapper that allows defining (unambiguously) set operations (union
,intersect
,isempty
, etc.) in the sense of interval arithmetic.This PR removes the
IntervalBox
struct, in favour of just usingAbstractVector{<:Interval}
.Note that set operations (
union
,intersect
,isempty
, etc.) are now confusing since they have a completely different meaning forInterval
andAbstractVector
; thus this PR also renames such operations following the standard.Name changes:in
->ismember
isthin
->issingleton
(aesthetic change to match the standard)isdisjoint
->disjoint
union
completely removed, it was an alias ofhull
hull
->convexhull
(aesthetic change to match the standard)intersect
->intersection
issubset
->subset
isstrictsubset
->strictsubset
isweaklyless
->less
(aesthetic change to match the standard)setdiff
->setdiffinterval
isempty
->isemptyinterval
isentire
->isentireinterval
(aesthetic change for consistency)≛
(\starequal<tab>
) ->≐
(\dotequal<tab>
, I changed the star for a dot, since in the standard I saw symbols with dots..) and is now in theSymbols
module, defined to be the unicode alias of a new functionequal
Of coursedisjoint
,intersection
,subset
,less
andequal
are semantically very close to theBase
functionsis disjoint
,intersect
,issubset
,isless
andisequal
respectively. Nevertheless, I think if we document this properly (using many admonitions 🙂) this should be find.EDIT: see #572 (comment) for the current name changes.
I did not define all these functions for
AbstractVector
. Onlybisect
,mince
andsetdiffinterval
are defined since the others can be defined in one line, e.g.intersection(x::AbstractVector) = intersection.(x)
. Yet, should we define such functions? One benefit could be that it allows for writing code that works seamlessly for anInterval
or a multidimensional interval.cc-ed @Kolaru
P.S.: unrelated to the rest, but while I was renaming things, I also changed
midpoint_radius
tomidradius
for consistency, sincemidpoint
is themid
function.