Skip to content

Commit 42e497e

Browse files
committed
Avoid extending Base.isopen
The `isopen` function defined here is very different and so it seems best we define a new function rather than extend `Base.isopen`. Doing this means we need to export `Intervals.isopen` to make this change non-breaking however doing this results in: ```julia WARNING: both Intervals and Base export "isopen"; uses of it in module Main must be qualified ERROR: UndefVarError: isopen not defined ``` It then seems best to not export `Intervals.isopen` and also then not export `Intervals.isclosed` to keep things consistent.
1 parent 99abb65 commit 42e497e

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/Intervals.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export AbstractInterval,
3232
inclusivity,
3333
first,
3434
last,
35-
isclosed,
3635
anchor,
3736
span,
3837
merge,

src/inclusivity.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Base.first(x::Inclusivity) = x.first
3838
Base.last(x::Inclusivity) = x.last
3939

4040
isclosed(x::Inclusivity) = first(x) && last(x)
41-
Base.isopen(x::Inclusivity) = !(first(x) || last(x))
41+
isopen(x::Inclusivity) = !(first(x) || last(x))
4242

4343
Base.isless(a::Inclusivity, b::Inclusivity) = isless(convert(Int, a), convert(Int, b))
4444

src/interval.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Base.last(interval::Interval) = interval.last
114114
span(interval::Interval) = interval.last - interval.first
115115
inclusivity(interval::AbstractInterval) = interval.inclusivity
116116
isclosed(interval::AbstractInterval) = isclosed(inclusivity(interval))
117-
Base.isopen(interval::AbstractInterval) = isopen(inclusivity(interval))
117+
isopen(interval::AbstractInterval) = isopen(inclusivity(interval))
118118

119119
##### CONVERSION #####
120120

0 commit comments

Comments
 (0)