<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One could also think of it as an algebra of structs.<br>
<br>
It would be nice to be able to do stuff like<br>
<br>
A + B, A - B(possibly useless), A*B(possibly useless), etc...<br>
<br>
A + B would just combine the members, A - B could remove the members that overlap, A*B could qualify overlapping members.<br></blockquote><div> </div><div>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) ).</div>
<div><br></div><div><br></div><div>What you're trying to do is doable in D, but you'd have to define it a bit more:</div><div><br></div><div>if we have </div><div><br></div><div>struct A { int a; int b}</div><div>
struct B { int b; int a} // just a and b swapped.</div><div><br></div><div>What is `A+B`? `A-B`?</div><div><br></div><div><br></div></div>