Building the next new language
Ted Neward wants relational language extensions:
Basically, I want the object-relational impedance mismatch to go away, just like everybody else does. But instead of continuing to try to force objects on top of the relational model, how about we give up going in that direction, and instead try lacing relational semantics into our favorite languages of choice? ....What I really want to do, in a single sentence, is extend the data model away from a concept of "fields" and include some higher-order primitives into the mix. For example, coming from the relational world, I want to see a relvar, a relational variable a la C. J. Date, as a basic primitive type within the language....I want a node primitive type, to which I can apply XPath operations... I envision something along the lines of:
[Thinking In .NET]relvar r = { fn, ln, age} [ ["Ted", "Neward", 32] ["Don", "Box", 39] ]; foreach (tuple t in r) { printOut("Name is " + t.fn + "" + t.ln + ", " + t.age + " years old"); }and so on. Syntax is somewhat derived from Date, 8th ed.relvar r2 = { fn, ln, age} [ ["Fritz", "Onion", 39] ];
relvar r3 = r UNION r2;
printOut(r3.count); // Prints "3", since there are 3 tuples
Similarly, I want the ability to do XPath over XML as built-in language capabilities; something along the lines of:
node n =Ted
string s = n/name/text(); // an XPath query against the node "n"and, of course, both node and relvar types would support the usual range of insert/remove operations, such as the UNION used above, or a += syntax for appending nodes to n as child nodes, and so on..... Oh, and while we're at it, I want the language to understand transactions as a first-class processing concept, too:
via
x = 5;
transacted
{
x += 5;
throw new IllegalArgumentException("can't do this!");
}
finally // a.k.a. commit
{
printOut("We committed! x = " + x);
}
rollback
{
printOut("We rolled back! x = " + x);
}// x has the value "5", since the exception forces an implicit rollback
[The Mountain of Worthless Information]
Interesting thought. Especially for a die-hard relational database freak like me.