[FoRK] Top general purpose languages: Practical choices for app logic / presentation & web / server apps

Damien Morton dmorton at bitfurnace.com
Tue Jan 18 19:01:47 PST 2011


On Tue, Jan 18, 2011 at 10:09 PM, Stephen Williams <sdw at lig.net> wrote:

> On 1/18/11 2:31 PM, Damien Morton wrote:
>
>>
>> Its worth downloading Visual Studio Express (the free version of VS) and
>> having a play with LINQ, It really is done in a completely general way,
>> and
>> people are doing all kinds of incredible things with it. Think of it as a
>> language extension that turns an SQL-like sublanguage into parse trees
>> that
>> can be processed by the language itself at runtime. The simplest version
>> of
>> it does dumbass processing of collections of objects, for example
>> selecting
>> a bunch of objects from a collection based on some kind of condition. More
>> sophisticated versions leverage its power to provide querying
>> of arbitrary data stores, for example, an LDAP store. In other words, yes
>> you could do you own RDF query language, by creating a LINQ query
>> provider.
>>
>> I found this list of LINQ providers:
>> http://blog.linqexchange.com/index.php/links-to-linq-providers/
>>
>> LINQ is something quite unique to C#. The closest thing I can think of is
>> some of the LISP meta level programming.
>>
>>  Doesn't seem too difficult to do in Java or C++ in some analogous way.  I
> will take another look soon, especially since I've been thinking of concise
> programming issues.


Do take another look. Its not something that can be implemented in a library
system - it needs to be implemented at the language/compiler level.

There are two main parts to it
1. an SQL like language, which gets transformed to a pipeline of function
calls with lambdas as parameters (essentially map, reduce, select, etc)
2. The ability to declare that a lambda function parameter is not a function
reference, but rather is a parse tree (of a lambda). e.g. in
collection.where(x=>x>3) can have the x=>x>3 boolean predicate turned into a
parse tree which is transformed and interpreted, for example,  against an
SQL store.

There are hackish sorts of ways of doing this in C++, by overloading
operators and such. As far as I know the only way to do this in Java is by
analyzing bytecodes and trying to rebuild the parse tree that way.


More information about the FoRK mailing list