Lecture 11: Heterogeneous Metaprogramming in F#

2 November 2010

This is the last of three lectures on integrating domain-specific languages with general-purpose programming languages. This lecture looked at metaprogramming, where one program manipulates another; in particular the possibilities for heterogeneous metaprogramming provided by the LINQ framework mentioned in the previous lecture. This leads to an example from the following paper where existing F# code for running Conway’s Game of Life can be automatically transformed to run on a GPU.

D. 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. DOI 10.1145/1159876.1159884

Link: Slides

Coursework office hour

If you have questions or problems you wish to raise regarding the course or your coursework, you can bring them to me this Wednesday afternoon.

Office Hour: 1.30–2.30pm Wednesday 27 October, Informatics Forum 5.04

If the turnstile gates are closed and your student card does not open them, ask at the front desk for admission.

Otherwise, please post any questions here on the blog or by email either to the mailing list apl-students@inf.ed.ac.uk or to me Ian.Stark@ed.ac.uk.


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 19: Heterogeneous Metaprogramming in F#

15 March 2010

General 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:

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.


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.