On Friday, 4 April 2014 at 01:31:20 UTC, bearophile wrote:
The point of that part of the rant is that using an integer is
very not-precise, typing-wise. Having more precise typing
sometimes helps.
In a little higher level language using a 3-value enum (as in
Haskell, more or less) is still sufficiently efficient. And Ada
language shows that often you can have both precise types
(strong typing) and almost C-like efficiency.
Bye,
bearophile
I would agree if D actually had type-safe enums.
enum a
{
val = 1
}
enum b
{
val = 1
}
assert(a.val - b.val == 0);