From: David Vallner Date: 2006-12-06T07:58:56+09:00 Subject: Re: Lisp comprehensions => SQL --------------enig61ED7DA553C91790ACB1CA76 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Victor "Zverok" Shepelev wrote: > Hi all. >=20 > Random idea, just for fun - using "list comprehensions" for SQL queries= > generation. >=20 I think it has been done verbatim, can't recall the library. Search the archives? > Also MS's LINQ and ruby's Mongoose DB seems to do something like this. >=20 MS's LINQ does the opposite, allowing SQL-ish constructs to express list comprehensions on steroids. Well, basically; I have my doubts about the more relational features like joins on object collections performing any well (no concept of the dataset, no analysis thereof to do query planning, probably no indexing either) or making actual sense whatsoever (why join when you can just use direct references?). From a design point of view, I'd prefer preintegrating data into a clean domain model instead of bridging over with the band-aid that is generalised data structure query. It's boilerplate, more effort, and less "whoa, cool", but you get a high level of consistency in the core business logic if you take care of the data format impedance mismatch up front instead of putting over a bandaid later. (No "What paradigm am I coding THIS line in again?" issues.) The field of data modelling seems way too varied to me for one query language / paradigm to work universally without kludges appearing around the edges. (For the obvious impaired: I just don't like LINQ. By far the ugliest and most out of place addition to C#3.0.) > But the realization of above seems to be interesting task (for RubyQuiz= , may > be?) >=20 Well, to work with blocks, you'd need to involve ParseTree or something like that, unless you're willing to offload some of the logic back to the interpreter (gruesomely laggy). That might be a little out of scope for a RubyQuiz. Then again, having seen some of the more golfy / braintwisting solutions to some problems, maybe not :) David Vallner --------------enig61ED7DA553C91790ACB1CA76 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFdfmty6MhrS8astoRAnW5AJ9ppVyCvh6rqD2Zm4L3TUeRWz74bwCfcojd Fz+tBJgzaECyI0iplY/hC4k= =R24x -----END PGP SIGNATURE----- --------------enig61ED7DA553C91790ACB1CA76--