On Thu, 15 Dec 2005, Luke Palmer wrote:

On 12/15/05, Darren Duncan <[EMAIL PROTECTED]> wrote:
I propose, perhaps redundantly, that Perl 6 include a complete set of
native

Okay, I'm with you here.  Just please stop saying "native" and "core".
Everyone.

Here, here.

I would like to hear from Ovid and Dave Rolsky on this issue too, as
they seem to have been researching pure relational models.

My take on this is that with all the features that are supposed to be in Perl6, implementing a declarative mini-language for relations and tuples would be a simple matter of programming ;)

The following bits seem to me to be key to making this work:

* built-in set operators, which can presumably be overloaded
* powerful OO system
* optional strong typing
* macros and grammar engine

So we can do stuff like this:

 my $emp_rel = Relation.new_from_dbms('Employee');
 my $dep_rel = Relation.new_from_dbms('Department');

 my $emp_dep_rel = $emp_rel natural join $dep_rel; # natural join is a macro of 
some sort

 my @array = $emp_dep_rel.sorted_tuples($emp_rel.attribute('name'));

This is a kind of bastardized semi-logical semi-OO language, but presumably we could do this instead

  my $relation = relational($dbh, <<EOF);
    ( ( Employee RENAME name AS employee_name ) NATURAL JOIN ( Department 
RENAME name AS department_name ) )
    WHERE X.department_name = 'Management'
  EOF

And then presumably the Perl-side of the implementation will have some sort of object that does relational things, like:

  my $iterator = $relation.iterator( sort => 'employee_name' );

In fact, there's really no reason this couldn't be done in Perl5 today. The hard part is gluing the Perl bits to a DBMS, or alternatively implementing all of the relational logic (and therefore an RDBMS) in Perl.

Given that there is no truly relational DBMS available, I'm not sure exactly what Perl6 can do here, as the hard part is implementing such a that TRDBMS. Of course, you could implement one client-side on top of a SQL DBMS. It's just a simple matter of programming ;)


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to