Hi
On 10/29/22 00:44, Jordan LeDoux wrote:
I had a discussion with Tim about this naming topic as well, and want to
convey my suggestion along with the reasoning.
I think the enum should be `Random\IntervalBoundary` with the enum cases:
Yes, I agree this is a much better name for the enum itself and just
adjusted the implementation and RFC.
`IntervalBoundary::Open`
`IntervalBoundary::Closed`
`IntervalBoundary::OpenRight` or `IntervalBoundary::HalfOpenRight`
`IntervalBoundary::OpenLeft` or `IntervalBoundary::HalfOpenLeft`
But for the enum members I prefer the existing naming of
(Closed|Open)(Closed|Open), unless someone has a good argument for a
different naming scheme:
- It's very explicit, which I consider useful for two reasons which are
likely related:
(a) I don't have to think about what "OpenRight" means for the left
boundary.
(b) As not-a-native-speaker-of English I find OpenRight or HalfOpenRight
not completely obvious and would likely need to look up what exactly
OpenRight means, whereas ClosedOpen is understandable more intuitively.
Especially since a half-open interval is sometimes referred to as
half-open and sometimes as half-closed. The preferred variant might even
differ across languages.
- It's nicely symmetric from the naming.
- It's the naming used by Prof. Goualard in the Drawing Random
Floating-Point Numbers from an Interval paper (though in a shortened CC,
CO, OC, OO variant).
Best regards
Tim Düsterhus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php