This is the second of three lectures on integrating domain-specific languages with general-purpose programming languages. In particular, SQL for database queries. This lecture presented LINQ, Language Integrated Query, together with some background on Microsoft’s .NET framework, and the language features added to C# to support LINQ.
Read the rest of this entry »
Lecture 10: Bridging Query and Programming Languages
29 October 2010
6 Comments |
Lecture log | Tagged: .NET, LINQ, metaprogramming, Microsoft Windows, sql |
Permalink
Posted by Ian Stark
Lecture 9: Using SQL from Java
26 October 2010This is the first of three lectures on integrating domain-specific languages with general-purpose programming languages. In particular, SQL for database queries.
Read the rest of this entry »
4 Comments |
Lecture log | Tagged: HTML, Java, metaprogramming, sql |
Permalink
Posted by Ian Stark
Lecture 20: Type-Checking for SQLizability
18 March 2010Review 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.
Homework
Please fill out and submit an anonymous feedback questionnaire. Thank you.
Comments Off on Lecture 20: Type-Checking for SQLizability |
Lecture log | Tagged: Links, metaprogramming, sql, types, types and effects |
Permalink
Posted by Ian Stark
Lecture 19: Heterogeneous Metaprogramming in F#
15 March 2010General overview of metaprogramming, with a range of examples in different languages ranging from C macros through Java reflection to MetaOCaml. Brief summary of the F# language, its history, features, and upcoming release in VS 2010.
Metaprogramming in F#, and how it can be combined with LINQ for database queries, runtime code-generation, and outsourcing computation. How to run Conway’s Life on a GPU without changing your code. This is based on the following paper:
- Don Syme. Leveraging .NET meta-programming components from F#: Integrated queries and interoperable heterogeneous execution. In ML ’06: Proceedings of the ACM SIGPLAN 2006 Workshop on ML, pages 43–54. ACM Press, September 2006.
To find out more about this, try also reading the series of articles about accelerating data-parallel code in F# on Tomáš Petrícek’s blog.
Finally, a job ad to work with the F# team.
Links: Slides; F# Developer Network; F# at Microsoft Research; Visual F# Developer Library; Don Syme as Geek of the Week.
Comments Off on Lecture 19: Heterogeneous Metaprogramming in F# |
Lecture log | Tagged: .NET, F#, metaprogramming, sql |
Permalink
Posted by Ian Stark
Lecture 18: Bridging Query and Programming Languages
11 March 2010How the LINQ framework for Language-Integrated Query aims to reduce the impedance mismatch between programming languages and query languages.
General background on Microsoft’s .NET Framework: it’s a large platform for program development; as part of this, it has some interesting programming language features. In particular its support for working in multiple languages, exchanging strongly-typed data and code at a high level.
Review of standard SQL-query-as-a-string technique in Java and (almost identically) in C#. Advantages, limitations. What LINQ does to lift some of the limitations. There is convenient SQL-style syntax; but that’s a distraction, the key advance is to connect the semantics of the two language domains. This then brings in type checking, smart IDEs, compiler optimisations, automatic query bundling, abstraction of query constructors, query constructor constructors, user-extensible query libraries, etc. etc.
How this requires (and contributes) a sackful of additional language features, most taken from existing research languages, which themselves have wider application; LINQ as a Trojan horse.
The end result is that a LINQ programmer can write a simple boolean test in C#, or any .NET language, and use it to filter all kinds of data: an array in C#, a table in SQL, or a tree in XML. All being well, LINQ will inspect the semantics of the underlying expression and convert it to the right domain.
Next week: what else it can do, when it doesn’t work, and how that might be fixed.
Link: Slides
What’s in a Name?
During the lecture I referred to the work of Mike Just and others on knowledge-based authentication. There is a discussion of this on the Light Blue Touchpaper security blog, and you can also read the recent published paper and some slides from a recent presentation.
Comments Off on Lecture 18: Bridging Query and Programming Languages |
Lecture log | Tagged: .NET, C++, Java, LINQ, metaprogramming, sql |
Permalink
Posted by Ian Stark