Lecture 10: Bridging Query and Programming Languages

29 October 2010

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 18: Bridging Query and Programming Languages

11 March 2010

How 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.

Update: Also appears on BBC News, Telegraph, etc.

Lecture 12: Heterogeneous Metaprogramming in F#

19 February 2009

Metaprogramming, code that manipulates code.  Examples: macros, templates, eval; quotation, quasiquotation, antiquotation; staged computation; run-time code generation, self-modifying code; MetaOCaml, homogeneous vs. heterogeneous metaprogramming, offshoring code.  The F# programming language; background, motivation; mixture of ML and .NET; interlanguage working.  Metaprogramming with LINQ: expressions in C#; quotations in F#, strongly typed expression data; using LINQ to map F# source to SQL queries; lightweight runtime code generation; Conway’s Game of Life in F#, outsourced to run on a GPU.

Advertisements for Martín Escardo’s seminar this afternoon, and Sam Lindley’s talk on Database Programming Without Tiers as an APL guest lecture on Monday.

Links for background material now available below. Read the rest of this entry »