Since Alan keeps talking about GLORP, I'm gonna talk about ROE...
I've been recently trying a new approach to ambiguous attribute references.
Say you have two tables, Professor and Course, and they both a column called 'name'. You want to find the names of any courses taught by a professor named 'Bryant'. In SQL, the query would look like this:
SELECT Course.name FROM Course, Professor WHERE Course.profID = Professor.id AND Professor.name = 'Bryant'
In earlier versions of Roe, however, there was no way to do a Table.column reference, so you had to use aliasing instead. You would first get versions of the professor and course relations with more specific attribute names:
profAlias := professors rename: #name to: #profName.
courseAlias := courses rename: #name to: #courseName.
Now, anywhere that an attribute name was previously accepted, you can also use an attribute object. So, the above example could look instead like this:
Not a huge deal, maybe, but I always prefer to compare object identity where possible instead of symbols. Another nice example of this is in self joins, where you "alias" a relation by cloning it and assigning it to a different variable. Note also the sugar #>> for #attributeNamed: .
"find all customers with the same last name"
customerAlias := customers clone.
^ (customers * customerAlias select: [:ea | (ea at: customers>>#name) = (ea at: customerAlias>>#name)])
Obviously this still has to generate a bunch of AS clauses in the SQL, but you don't have to worry about what they are.