On 8/17/15 2:56 PM, Sönke Ludwig wrote:
- The enum is useful to be able to identify the types outside of the D
code itself. For example when serializing the data to disk, or when
communicating with C code.
OK.
- It enables the use of pattern matching (final switch), which is often
very convenient, faster, and safer than an if-else cascade.
Sounds tenuous.
- A hypothesis is that it is faster, because there is no function call
indirection involved.
Again: pointers do all integrals do. To compare:
if (myptr == ThePtrOf!int) { ... this is an int ... }
I want to make clear that this is understood.
- It naturally enables fully statically typed operator forwarding as far
as possible (have a look at the examples of the current version). A
pointer based version could do this, too, but only by jumping through
hoops.
I'm unclear on that. Could you please point me to the actual file and lines?
- The same type can be used multiple times with a different enum name.
This can alternatively be solved using a Typedef!T, but I had several
occasions where that proved useful.
Unclear on this.
Andrei