-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18093/#review34416
-----------------------------------------------------------
Two thoughts:
(1) We should be more opinionated about how we want people to construct an
interval, rather than providing multiple different ways and then trying to
decide later which one we want people to use. Given the current API you've
proposed, I would at least remove the leftOpen and rightOpen or remove the
builder style since they accomplish the same thing (and in fact, the builder
style also lets you do just 'open' and 'closed' too).
(2) C++ allows you to overload the "comma" operator which could make for a very
interesting way to construct intervals, consider:
struct Interval
{
struct Open;
struct Closed;
struct Open
{
Open(int i) : i(i) {}
Interval operator , (const Open& open) { return Interval(...); }
Interval operator , (const Closed& closed) { return Interval(...); }
const int i;
};
struct Closed
{
Closed(int i) : i(i) {}
Interval operator , (const Open& open) { return Interval(...); }
Interval operator , (const Closed& closed) { return Interval(...); }
const int i;
}
private:
Interval(...) {}
...;
};
Then you can do:
Interval interval = (Interval::Open(10), Interval::Closed(42));
But note you _won't_ be able to do:
Interval interval = Interval::Open(10), Interval::Closed(42);
And then the only way to construct an interval is to finish the "building" by
invoking one of the comma operators.
3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp
<https://reviews.apache.org/r/18093/#comment64507>
s/Syntax/Syntactic/
- Benjamin Hindman
On Feb. 14, 2014, 5:38 a.m., Jie Yu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18093/
> -----------------------------------------------------------
>
> (Updated Feb. 14, 2014, 5:38 a.m.)
>
>
> Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.
>
>
> Bugs: MESOS-993
> https://issues.apache.org/jira/browse/MESOS-993
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> See summary.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/Makefile.am 51b118c
> 3rdparty/libprocess/3rdparty/stout/Makefile.am 5d5a760
> 3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp PRE-CREATION
> 3rdparty/libprocess/3rdparty/stout/tests/interval_tests.cpp PRE-CREATION
>
> Diff: https://reviews.apache.org/r/18093/diff/
>
>
> Testing
> -------
>
> make check
>
> repeat 1000 times for the IntervalTest
>
>
> Thanks,
>
> Jie Yu
>
>