Just sayin', fwiw...
Johan Coder
johan at coder.org
Thu May 16 20:13:23 UTC 2019
On Thursday, 16 May 2019 at 17:47:26 UTC, H. S. Teoh wrote:
> The REAL problem as Walter has pointed out elsewhere is that
> Phobos uses far too much function overloading. I'd say Phobos
> abuses function overloading. There are far too many overloads
> that ought *not* to be overloads, but should be merged into a
> single, logical function with various cases differentiated by
> static ifs inside the function body, with a static assert at
> the end explaining the problem should none of the cases match.
...
> I've already repeated this many, many times, but there still
> remains a lot of Phobos/druntime code written according to this
> anti-pattern, including a recent example of hashOf being a
> *21*-function overload set in druntime. Insane!! Glancing
> through those overloads reveals that the sig constraints are
> all implementation details, i.e., they should NOT be sig
> constraints in a public-facing API, but static if conditions
> inside the function body dispatching to various different
> implementations.
>
> Abusing overload sets for this purpose is an anti-pattern, and
> needs to stop.
More than stop it needs to be repaired. Documentation is bizarre
because of them. But so much discussion changing bool and <...
More information about the Digitalmars-d
mailing list