Miguel Garcia | 19 Oct 17:57 2009

[ANN] towards language-integrated query for Scala (yes, LINQ for Scala)

Hi all,

From time to time a new solution is proposed to the age-old problem of 
transparent persistence.

Today is one of those days.

My team and I have reported on using compiler plugins to translate database 
queries into SQL:1999, using a very capabable intermediate language (Ferry) 
in connection with its very capable optimizer. After following developments 
in this area for some time, I see some innovative aspects in the proposed 
approach (e.g., an analysis of integration levels between programming and 
query languages). So you might want to take a look.

Extending Scala with database query capability
in Journal of Object Technology, July-August 2010, (To appear).


The integration of database and programming languages is difficult due to 
the different data models and type systems prevalent in each field. We 
present a solution where the developer may express queries encompassing 
program and database data. The notation used for queries is based on 
comprehensions, a declarative style that does not impose any specific 
execution strategy. In our approach, the type safety of language-integrated 
queries is analyzed at compile-time, followed by a translation that 
optimizes for database evaluation. We show the translation total and 
semantics preserving, and introduce a language-independent classification. 
According to this classification, our approach compares favorably with 
Microsoft's LINQ, today's best known representative. We provide an 
implementation in terms of a Scala compiler plugin, accepting two notations 
for queries: LINQ and the native Scala syntax for comprehensions. The 
prototype relies on Ferry, a query language that already supports 
comprehensions yet targets SQL:1999. The reported techniques pave the way 
for further progress in bridging the programming and the database worlds.



Miguel Garcia                                     miguel.garcia@...
Institute for Software Systems (STS), E-16
Technische Universitaet Hamburg-Harburg
Harburger Schlossstr. 20, 21073 Hamburg         Fax: (+49)40-42878-2515