Hacker News new | ask | show | jobs
by gmueckl 2245 days ago
A Range is something that implements one or more interfaces depending on its properties and guarantees. So in order to name a Range that way you'd first have to create interfaces for all possible guarantees. That doesn't sound practical. It's analogous to C++ containers implementing common concepts without deriving from corresponding interfaces.

See also https://tour.dlang.org/tour/en/basics/ranges

1 comments

Yes, this is what C++ concepts are supposed to solve: https://en.cppreference.com/w/cpp/language/constraints