How to have strongly typed numerical values?
bearophile
bearophileHUGS at lycos.com
Tue Sep 4 18:42:33 PDT 2012
Nicholas Londey:
> for example degrees west and kilograms such that they cannot be
> accidentally mixed in an expression.
Using the static typing to avoid similar bugs is the smart thing
to do :-)
I have vague recollection of seeing a presentation
> by Walter talking about this but I cannot seem to find it. I
> have looked at std.typecons.Typedef and Proxy but neither seem
> to do what I want or at least fail to compile for the
> expression n = n + n;.
std.typecons.Typedef is kind of broken.
> but assume there is a standard implementation which I would
> prefer.
I think Phobos doesn't have a standard implementation.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list