[xquery-talk] XQuery and Web 2.0
lord at emf.net
Fri Apr 25 11:14:00 PDT 2008
Peter Coppens wrote:
>> XQuery was designed as a query language and it does that job very
>> well. It
>> was not designed as a general-purpose programming language, and I
>> think it's
>> a mistake to try and use it as one.
> Yes...that is also my experience. It is a mistake, sometimes fun, but
> a mistake nevertheless.
I agree it is fun. I'm not sure it is a mistake.
It works pretty well in my (limited) experience using it so. For web
applications, and backed by a good database, it can be a joy because it
eliminates "impedance mismatches" that otherwise arise converting
between XML, the ad hoc run-time data types of some random scripting
language, and relational tables. And it's swell to have unification
between querying and data structure constructors and destructors.
The main obstacle in my experience is that you need to add "something"
to the language in order to be able to program the sequencing of side
effects such as database updates and I/O. I understand that people
are working on extensions to XQuery for that purpose although I'm
unclear that that is a wise approach.
In my systems, I handled sequencing by evaluating XQuery programs in a
loop, each iteration of the loop returning a description of side effects
to perform and, optionally, a continuation. If present, the
continuation is the next XQuery program to run in the loop. This is
simple and effective although it is unusual enough that it takes some
time to get used to it.
My site http://basiscraft.com offers "Flower" - a little early-stage
system that illustrates that concept.
> talk at x-query.com
More information about the talk