On Wed, Apr 01, 2009 at 03:01:03PM +0000, Tobias wrote:
>
> I didn't know what is apparently the ISO notation
> (<http://en.wikipedia.org/wiki/Interval_(mathematics)>); I was familiar
> with the "set builder notation":
>
> [1,200] would find 1<=x<=200
> (1,200) would find 1<x<200
> [1,200) would find 1<=x<200
I can live with that, too.
> What about accepting input like this:
>
> 1 <= x <= 200 # Python; accept any identifier
> >=1 and <=200 # pythonic/english "and"
> >=1 && <=200 # C, Bash, DOS-Shell
>
> 1 < x < 200 # Python; accept any identifier
> >1 and <200 # pythonic "and"
> >1 && <200 # C, Bash, DOS-Shell
>
> 1 <= x < 200 # Python; accept any identifier
> >=1 and <200 # pythonic "and"
> >=1 && <200 # C, Bash, DOS-Shell
This looks too complicated to me and doesn't fit well with the
already-existing syntax for date ranges. If you want the added
complication of boolean expressions, these should be optional for
application like searching for multiple ranges, e.g.,
(5, 27) or [99,100)
alternatively:
(5, 27), [99,100)
> We could create a callable object when parsing a non-empty expression.
> The concept could be extended to evaluate parentheses and even field
> names (for a one-entryfield search function). The comma could be
> interpreted as "and".
>
> We could generate boolean functions (accepting a single number) or,
> perhaps better, SQL code (for the WHERE clause).
You'll probably need both for the various backends. For SQL backends you
definitely want to generate SQL. For dbm you need some boolean
expressions. And our input syntax should cover a subset of what can be
expressed in SQL (semantically not syntactically).
and we should keep in mind that we may want to use the new syntax for
dates, too (optionally, I think we need to be backward compatible)
Ralf |