Dispatching on a variant

Justin Johansson procode at adam-dott-com.au
Sat Sep 26 17:28:50 PDT 2009


Andrei Alexandrescu Wrote:

> Justin Johansson wrote:
> > At the end of the day, if I can get this thing to fly using D, it will,
> > at least to me, prove that D is a killer language.
> 
> One way or another you will, and if you have difficulties let us hear of 
> them. Practical experience with Algebraic and friends is very valuable.
> 
> Andrei

Thanks, Andrei, for your very encouraging and supportive comments.

My feeling is that I should stick with the new design using Algebraic even if
the current regime means I need to use a long series of if else if else's.

By the time I get towards finishing this project, matters may well have
improved in std.variant and then I can easily upgrade my code at no cost.

OTOH, to go backtracking at this time, to one of the old schools of
(1) non-discriminated unions or (2) everything-is-an-object
just to work around a current deficency in std.variant would almost certainly
be an extremely bad software engineering design decision, and having serious
impact upon both runtime performance and code maintainability.

It would also do absolutely nothing to improve the enjoyment and quality of my life :-)

The beauty of my current design is that it appropriately addresses the 80/20 rule
of where time and money should be spent in a project of this nature.

Further, and worth mentioning given another raging thread on this forum at the moment,
it turns out the ensuring type-safety of my design means that NPE's are a thing of the
past (for me at least).  This is due to strong static type checking together with runtime type
validation all for a pretty reasonable cost.

So it's pretty obvious which side of the fence I'm on in the null ref redux debate.

Cheers
Justin




More information about the Digitalmars-d mailing list