Static Const Object Polymorphism

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 23 19:44:37 PDT 2015


To be put this bluntly this is not idiomatic D and for good reason.
A lot of what you are trying to do, should be handled at runtime. Not at 
compile time.

Ignoring the fact that you posted a wall of text (hence I barely got 
through half of it), you've come up with a very neat idea of a very 
configurable queue.

Also remember, structs are nearly free, classes are very expensive. OOP 
advocates don't tell you that. Queues are one thing that can be done via 
structs. Also protected doesn't do what you think it does. Most of the 
time it is never used in D at all.

I'm going to suggest reading my book[0] regarding Compile Time Function 
Execution. But it is more for advanced users of D.

Unfortunately I didn't find a good queue to point you to. So you could 
learn more of how it is applied in D. Instead I'll recommend the 
std.container.array Array container.
Ugh, looks like it needs work on the documentation front. Oh well.

One thing, template bloat is a big problem. There is a good chance, if 
you specify something at compile time it will hang around like a 
barnacle per type initiation. You probably won't notice too big of a 
compile speed hit on this sort of code. But you are not far from it.

I know most of my reply has been pretty negative. But I really do think 
it is neat.

[0] https://leanpub.com/ctfe
[1] 
https://github.com/D-Programming-Language/phobos/blob/master/std/container/array.d


More information about the Digitalmars-d mailing list