Following up with my recent on-#perl6 promises, I have started to
implement a Perl 6 Relation class, in Pugs' ext/Relation/ directory.
It is conceptually similar to the Perl 6 Set class, but operates in 2
main dimensions rather than 1.
This barest-bones version has 2 main attributes, a new() constructor
submethod, and an export_to_hash() method which outputs what you
input to the first.
It is not yet tested to compile or execute, but that will come soon,
and it is visually more or less correct.
The next main tasks, feature-wise, are to add methods for relational
algebra, plus some that loosely resemble SQL operators
The next main tasks, implementation-wise, are to reimplement the
attribute that stores the member tuples with a multi-dimensional
hash, keyed on all the attributes, but I have to figure out the
details first; meanwhile, it is an array of hashes. Also note that
the number of dimensions and their types would vary for each Relation
object, so I can't pre-declare those in the class.
I should be continuing on this semi-daily, as I can afford time away
from $work and other tasks.
Feedback is welcome, although you may be better off waiting until
I've done "the next main tasks".
P.S. Note that this "Relation" class has nothing to do with my
"Rosetta" DBMS project, aside from their operating in similar problem
domains. The "Relation" is a proposal for a generally useful and
simple-ish data type to include in Perl 6 itself, while "Rosetta" is
a third-party toolkit for application building.
-- Darren Duncan