Hi Nicolas,
Thu, 12 Jun 2014 14:28:49 +0200
Nicolas Évrard <[email protected]>:
>>We get some astonishement with the current behavior of the client with
>>the range search syntax.
>>Currently: `Field: 1..42` will become
>>
>>    `[('field', '>=', 1), ('field', '<', 42)]`
>>But it seems people expect:
>>
>>    `[('field', '>=', 1), ('field', '<=', 42)]`
>>One point about the current behavior is that you can slide the range
>>by the length and it will not contain any duplication.
>>So what do you think?
>It depends as it is displayed by the two questions in this
>stackoverflow post:
>    
> https://english.stackexchange.com/questions/118402/when-is-between-inclusive-and-when-exclusive
>So I think it's a matter of convention and of context.
>The only way to be unambiguous would be to implement a different
>version of the .. operator:
>    Field: ]1, 42]
>    Field: [1, 42[

your answer shows IMHO the perfect solution, because it
respects both valid expectations:

    * "natural"-look-and-feel boundaries and
    * flexible slicing-optimized-boundaries.

The expectation from natural language:
[1..42] : 1 <= x <= 42 (1 to 42 all numbers inclusive)

The expectation from slicing:
[1..42[ : 1 <= x <  42 (1 to 41 all numbers inclusive)

And for sake of completeness the slicing super powers, which where
initially not requested:
]1..42] : 1 <  x <= 42 (2 to 42 all numbers inclusive)
]1..42[ : 1 <  x <  42 (2 to 41 all numbers inclusive)

>But the parser might not allow it.
Your chosen ][-syntax looks very familiar to me, because
it is what I learned in mathematics at school.

I do not know the parser implementation, but I would
change the parsing of [1..42] to "natural"
`[('field', '>=', 1), ('field', '<=', 42)]`.
But finding another syntax for slicing. If possible I would use what
you suggested [1..42[ or something different like [1::42] or 1to42.

Regards Udo
-- 
_____________________________
virtual things
Preisler & Spallek GbR
München - Aachen

Windeckstr. 77
81375 München
Tel: +49 (89) 710 481 55
Fax: +49 (89) 710 481 56

[email protected]
http://www.virtual-things.biz

Attachment: signature.asc
Description: PGP signature

Reply via email to