Actions
Feature #19698
openNeed an idiomatic way to define an empty range
Feature #19698:
Need an idiomatic way to define an empty range
Status:
Open
Assignee:
-
Target version:
-
Updated by nobu (Nobuyoshi Nakada) about 3 years ago
What is your “intention” to use an “empty” range?
And what do you think “idiomatic” way is?
Updated by shouichi (Shouichi Kamiya) about 3 years ago
What is your “intention” to use an “empty” range?
In a system I'm working on, I need to represent an empty date range. We can choose two arbitrary dates d1 and d2 where d1 > d2, then use d2 as a beginning and d1 as an end of a range. For example,
But I don't think this communicates well because d1 and d2 are too arbitrary and those concrete dates only create noises when reading code.
And what do you think “idiomatic” way is?
One idea is to add a constant e.g., Range::EMPTY just like Float::EPSILON.
Actions