improving the join function
Simen kjaeraas
simen.kjaras at gmail.com
Tue Oct 12 04:03:50 PDT 2010
Daniel Gibson <metalcaedes at gmail.com> wrote:
> inner join is the "normal" join, outer join means that, if a
> to-be-joined element has no "partner" in the other set (range), it's
> included in the output anyway with the partner having a NULL value.
> (This can be done for either the first, the second or both partners).
> natural join is like an inner join, but has no explicit predicate, the
> implicit predicate being that (in database tables) columns with equal
> names have to contain equal values. So natural joins are rather
> uninteresting for ranges I guess.
Natural join could easily be done in D for ranges of structs or classes.
(not sure how it would cope with polymorphism, though)
It's trivial to automatically generate a predicate that uses
__traits( allMembers ) to check that all fields with the same name have
the same value (and even to statically decline natural join on
types with eponymous fields of incompatible types).
--
Simen
More information about the Digitalmars-d
mailing list