Generality creep
9il
ilyayaroshenko at gmail.com
Tue Mar 19 15:03:14 UTC 2019
On Tuesday, 19 March 2019 at 02:52:34 UTC, Andrei Alexandrescu
wrote:
> Walter and I were looking at indexOf in the standard library.
>
> What's the moral of the story here? Generality is good, but it
> seems in several places in phobos (of which this is just one
> example), a combination of vague specification and aiming for a
> nice ideal of "work with anything remotely reasonable" has
> backfired into a morass of inconsistently defined and supported
> corner cases.
>
Phobos looks too generalized for me and not enough standardized.
For (well known) example, min/max functions for integers. Both
for security and safety reasons it is better to raise a
compile-time error rather than to implement clever signity-aware
comparison. I did this in Mir. There a lot of such small nitpicks
but their reimplementation make life either for middle size and
large projects. It would be nice to have well-standardized
generic building blocks like `mir`/`max` in Phobos with
verifiable BetterC availability.
Best,
Ilya
More information about the Digitalmars-d
mailing list