You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's a good point: it does seem to extend a little better to unbounded ranges.
Another thought I had is to use textual tokens like II, EI, IE, EE. That is a little awkward to read though and doesn't seem to work naturally for unbounded ranges.
I tried implementing it that way, and I ran into a problem. The ranges with no upper bound work fine, but the ranges with no lower bound won't compile and I don't understand why.
Activity
sfackler commentedon Jan 2, 2014
I kind of like the
range!('[' a, b ')')syntax. Would e.g.range!('(' , b ')')be the best syntax for a half-open range?jeff-davis commentedon Jan 2, 2014
That's a good point: it does seem to extend a little better to unbounded ranges.
Another thought I had is to use textual tokens like II, EI, IE, EE. That is a little awkward to read though and doesn't seem to work naturally for unbounded ranges.
jeff-davis commentedon Jan 2, 2014
I tried implementing it that way, and I ran into a problem. The ranges with no upper bound work fine, but the ranges with no lower bound won't compile and I don't understand why.
sfackler commentedon Jan 2, 2014
It tries to parse an expression first, fails and doesn't try the next option. Moving the no-lower-bound cases to the top appear to fix it.
jeff-davis commentedon Jan 2, 2014
Yes, thank you, I had just realized that and was about to update my comment.
+1 to this approach
We'll also need a basic constructor for an empty range and a range unbounded on both sides.
sfackler commentedon Jan 2, 2014
There's already
Range::empty()to construct the empty range, but we might as well addrange!(empty)andrange!('(',')')for completeness.sfackler commentedon Jan 2, 2014
I've added a macro to
types/range.rs. You'll have to copy/paste it into your source file for now until rust-lang/rust#11151 is finished up.make CopyBothDuplex struct `pub` (rust-postgres#25)
Merge pull request rust-postgres#25 from petrosagg/integrate-upstream