Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]
Date: Fri, 24 Jun 2005 21:38:55 GMT
> "Jan Hidders" <jan.hidders_at_REMOVETHIS.pandora.be> wrote in message
>>vc wrote: >>>The same holds true for the 'return' in XQuery (sorry I missed your >>>earlier message asking why I do not think XQuery is pure declarative). >> >>I still think that *that* is nonsense.
> Maybe. Now that we are done with Daplex, let's talk about XQuery ;)
By all means. Before we start let me confess that part of my research actually involves XQuery, so this is going to be a bit of a home game for me.
> I say 'return' works in a way similar to print, namely creating a side
> effect, changing the 'world' as it were, thereby destroying XQuery
> expression declarativity. What's your interpretation of return ? ( I want
> to say right away, to save us some time, that I believe one cannot
> interpret 'return' as the monadic return function.).
Well, to be precise, the for expression in XQuery is based on the monoid comprehension for lists, not the monadic comprehension for lists. But that is not what you meant.
Let's look at the following example:
for $x in (for $y in (1, 2, 3) return $y + $y) return $x * $x
Can you tell me what the side effect of the nested return is? As far as I can see it simply returns a value as is expected from the list comprehension.
>>There are operations in XQuery that have side effects, but the return >>clause is not one of them. The strange thing about the side effects in >>XQuery, by the way, is that they actually don't seem to make the language >>much less declarative or less functional.
> I do not know XQuery very well. What other [than return] side-effect
> operations do you have in mind ?
The node constructors. They extend the collection of XML fragments that an expression is evaluated against with a new fragment that may then be used by expressions that are evaluated after them.
- Jan Hidders