static code generation

Philippe Sigaud philippe.sigaud at gmail.com
Sun Dec 16 07:34:26 PST 2012


> One could also think of it as an algebra of structs.
>
> It would be nice to be able to do stuff like
>
> A + B, A - B(possibly useless), A*B(possibly useless), etc...
>
> A + B would just combine the members, A - B could remove the members that
> overlap, A*B could qualify overlapping members.
>

Usually, given types A and B, A+B means `A or B` (in D,
std.typecons.Algebraic!(A,B) ) and A*B means the tuple containing A and B
(in D, std.typecons.Tuple!(A,B) ).


What you're trying to do is doable in D, but you'd have to define it a bit
more:

if we have

struct A { int a; int b}
struct B { int b; int a} // just a and b swapped.

What is `A+B`? `A-B`?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20121216/cdcfe517/attachment.html>


More information about the Digitalmars-d-learn mailing list