Review of what LINQ can do in C# to lower the impedance mismatch between general-purpose programming languages and database query languages. Advantages and limitations on this; in particular the possibility of runtime failure, limits of abstraction, and the role of reflection.
One possible route to improving this: introduction of a type and effect system to track behaviour that cannot be represented in SQL. This allows arbitrary use of parametrization and higher-order functions, while providing compile-time guarantees of on-database execution. Outline of proof via a strongly-normalizing rewrite system. Several examples of how this more deeply embeds querying into a functional language, allowing modular construction of code and opening up queries to conventional compiler rewriting as well as SQL database-specific optimisations.
This lecture is based on the work of Ezra Cooper, in particular the following paper:
- Ezra Cooper. The script-writer’s dream: How to write great SQL in your own language, and be sure it will succeed. In Database Programming Languages: Proceedings of the 12th International Symposium DBPL 2009, Lecture Notes in Computer Science 5708, pages 36–51. Springer-Verlag, 2009.
You can follow his research blog for more on this.
Please fill out and submit an anonymous feedback questionnaire. Thank you.