I've been looking at how to implement named arguments and one approach that 
comes to mind is to replace the array of expressions which holds arguments with 
an array of Argument (a new type) which would contain the expression as well as 
the name of the argument, and possibly later the 

But here comes the problem. Everywhere in DMD, the Array struct holds raw 
pointers which then get casted to whatever you need in a given context. Having 
to cast every time you extract an element from an array prevents the compiler 
from doing proper type checking. This in turn makes it extremely perilous to 
refractor code in a way that changes the type contained in the array.

The standard C++ way to deal with that is to use a template parametrized on the 
type of content. I can understand that Walter likes that the compiler can 
compile even on the oldest C++ compiler, but at the same time I feel the lack 
of type-checking is holding us back.

I'd like to ask this: would it make sense to transform Array into a template 
and getting rid of all these casts? And if templates are still out bounds, 
couldn't we do the same using macros? What do you think?

-- 
Michel Fortin
[email protected]
http://michelf.com/



_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to