Just sayin', fwiw...
Steven Schveighoffer
schveiguy at gmail.com
Thu May 16 20:20:48 UTC 2019
On 5/16/19 6:47 PM, H. S. Teoh wrote:
> 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.
>
Context is important. I think this code was trying to replace 21
overloads of TypeInfo calls IIRC. So at least it's better than the
previous solution.
Refactoring would probably make sense, but not before you replace
exactly the existing solution.
-Steve
More information about the Digitalmars-d
mailing list