[Xesam] Xesam pending changes for RC2

Mikkel Kamstrup Erlandsen mikkel.kamstrup at gmail.com
Thu Dec 13 14:25:55 PST 2007


On 14/12/2007, Jaap Karssenberg <j.g.karssenberg at alumnus.utwente.nl> wrote:
> Mikkel Kamstrup Erlandsen wrote:
> ... 8< ...
> >> • What precendence do the AND and OR operators have ?
> >>
> >> Most programming languages give OR precedence over AND
> >>
> >
> > Name one, I don't know any that doesn't give AND precedence :-)
> >
>
> My mistake. I was confused because parsers for script languages chop up
> into OR blocks first before they evaluate the AND parts of the
> statement. Reason is that you always need to eval all parts of the AND
> block, while parts after an OR may not need to be evaluated. For query
> languages this logic does not work the same though. Anyway this goes to
> prove that there is very little difference unless you get into rather
> complex statements.
>
> >> 1 2 3 AND 4 5 6 OR 7 8 9 = (1 and 2 .. and 6) or (7 and 8 and 9)
> >>
> >> Giving AND precedence over OR seems less intuitive to me since AND is
> >> the default operator.
> >>
> >
> > Yes. This was discussed a while back on XDG. The conclusion was that
> > boolean ops was mostly for advanced users who where likely to
> > anticipate the standard precedence.
> >
>
> I see no problem giving AND precedence over OR, but I do see a problem
> giving the implicit AND operator or the "+" operator precedence over OR.
>
> So my proposal would be to make "+" the implicit operator and give AND
> and OR precedence over + and - .
>
> This makes parsing slightly more complex, but it makes queries much more
> intuitive. Also this complexity allows advanced users to make fairly
> complex queries without the need for grouping etc. Seems like a good
> trade-off to me. Also it gives "AND" an actual purpose over the implicit
> operator.

I am not outright against this, but it is a rather big change just
before a release candidate 2. It will need a good dicussion and +1
from all participants before we can include it.

Let me think about this a bit. In the meantime I would really love to
hear what other people think.

Cheers,
Mikkel


More information about the Xesam mailing list