Posts Tagged ‘DSLs’

COIL and COILettes

November 19, 2008 Leave a comment

Douglas Crockford started a minor war when he observed that JavaScript’s object initialisation syntax provides a neat way to persist hierarchical data, maybe more suitable to some situations than XML.

Since C# 3.0 we’ve had a similar facility in C#. This means an opportunity for another war.

I’ve started to see little object initialisation trees appearing in my code, and they start to look like a declarative internal DSL. I should post a real example some time. Anyway, this can only mean one thing: we need a snappy name for these things.

Read more…

Categories: C#, COIL, DSLs Tags: , ,

Fun with Internal DSLs in C++

November 7, 2008 Leave a comment

About three years ago I experimented with internal DSLs in C++. I didn’t know to call it that at the time (I’m not sure when the term was coined). It really means twisting the features of an existing language to make what feels like a new language.

The purpose of my DSL was to allow C++ programmers to naturally express database queries that would be executed against an RDBMS as standard SQL queries. In other words, it had exactly the same aim as LINQ, although again I wasn’t to know that at the time.

The starting point was a couple of template classes called column and table, which serve the purpose of making the names of tables and columns visible within the C++ type system.

Read more…

Categories: C#, DSLs Tags: ,