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

nomenclature constancy #14

Open
JeffreySarnoff opened this issue Mar 23, 2017 · 4 comments
Open

nomenclature constancy #14

JeffreySarnoff opened this issue Mar 23, 2017 · 4 comments

Comments

@JeffreySarnoff
Copy link
Member

David Sanders and I have given some attention to interval field naming in an attempt to find a seat of general agreement. Taking the best of both your contribution (parameterizing AbstractInterval) and our easy-peasy field naming, for directed intervals with two bounds (possibly equal), we have:

abstract type AbstractInterval{T} end

struct ConcreteInterval{T} <: AbstractInterval{T}
lo::T
hi::T

# inner constructor, if any

end

If you are amenable to the field name change, @dpsanders may be moved to parameterized abstraction. Each would be another step toward first-class intervals that just work and will do so intra-packagly.

@timholy
Copy link
Member

timholy commented Mar 23, 2017

I'm fine with field renaming. FYI for our applications it's important to be able to encode an empty interval with lo > hi. lo == hi is not empty, it has a single point in it.

@JeffreySarnoff
Copy link
Member Author

Yours and some of mine -- I lean on half-open intervals: 'instantons' are ephemeral and moments accrete.

@JeffreySarnoff
Copy link
Member Author

JeffreySarnoff commented Mar 23, 2017 via email

@timholy
Copy link
Member

timholy commented Mar 24, 2017

They are ranges without the implied step. For UnitRange, 1:0 is an empty range.

Example application: you want to find out whether two intervals intersect. The natural approach is to intersect them and then ask whether the returned interval is empty. If you can't define a value that means empty, then this straightforward approach doesn't work.

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

No branches or pull requests

2 participants