Re: approaches for embedding a data language in a general purpose language

From: dawn <dawnwolthuis_at_gmail.com>
Date: 9 Oct 2006 14:41:34 -0700
Message-ID: <1160430094.331631.52660_at_m73g2000cwd.googlegroups.com>


Marshall wrote:
> Hello all,
>
> There are various different approaches one can take for embedding
> a domain specific lanuage into a general purpose programming language.
> Common examples are regular expression libraries inside languages
> that don't directly support regular expressions, and, directly to our
> purpose, SQL inside Java or C/C++.
>
> The three main approaches I can think of are:
> 1) a library that accepts text written in the language as string
> parameters
> ex.: JDBC, ODBC
>
> 2) Code generation
> ex.: Hibernate, any one of ~1000 O/R mappers
>
> 3) Direct embedding using a preprocessor
> ex.: SQL-J, embedded SQL (for C) etc.
>
> I've used the first two extensively, but never the third one. I've got
> the nagging suspicion that it's the one I would like the best. (Of
> course
> one must immediately suspect grass-is-greener syndrome here.)

I don't have an answer to your question, but more questions along the same line. I don't follow .NET closely, but it looks like they might have made a wise decision with the linq project http://msdn.microsoft.com/data/ref/linq/ where they decided at some point to drop their interest in XQuery being handled like SQL. They have extensions to various .NET languages so the developer doesn't switch languages when working with data whether in a dbms or not, whether SQL or XQuery IIRC).

I haven't played with it, just admired it from a distance, but it seems like a good idea to abstract SQL to set up for moving beyond it, even though that doesn't sound like it is your specific concern here. I also think it is great if you can work with temporary data that is unrelated to a dbms the same way you handle data from a dbms. What do you think of the linq approach?

SQLJ seems to have lost out to Hibernate in the minds of many Java developers. Is that your guess too, and, if so, do you have a guess why that is? --dawn
<snip> Received on Mon Oct 09 2006 - 23:41:34 CEST

Original text of this message