You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Jiang Yan Xu <ya...@jxu.me> on 2013/10/03 07:45:23 UTC

Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/
-----------------------------------------------------------

Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.


Repository: mesos-git


Description
-------

This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
Need to compare if the result passed in is the same as the stored value.


Diffs
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 

Diff: https://reviews.apache.org/r/14457/diff/


Testing
-------

Tested along with https://reviews.apache.org/r/13086/


Thanks,

Jiang Yan Xu


Re: Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

Posted by Jiang Yan Xu <ya...@jxu.me>.

> On Nov. 5, 2013, 12:47 a.m., Jie Yu wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp, line 30
> > <https://reviews.apache.org/r/14457/diff/2/?file=377419#file377419line30>
> >
> >     I would prefer a more explicit syntax.
> >     
> >     When you want to create a Result instance which has a default value None(), here is the difference:
> >     
> >     Your way:
> >     Result result; // Default: None()
> >     
> >     More explicit way:
> >     Result result = None();
> >     
> >     I would prefer the latter one as it is more explicit.
> >     
> >     What do you think?

I didn't see much difference between Option and Result. None still carries the least amount of information and thus can serve as the default IMO.

I am not adamant about it though. I can remove the default constructor.


> On Nov. 5, 2013, 12:47 a.m., Jie Yu wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp, line 66
> > <https://reviews.apache.org/r/14457/diff/2/?file=377419#file377419line66>
> >
> >     This semantics look weird to me, especially the error message string matching part.
> >     
> >     Can we modify the call-site to make the comparison more explicit, instead of relying on '==' operator. (BTW: Try does not have '==' defined).

I see your point. 

Without typed/custom Errors I can't find a better solution for now but maybe we'll work something out later. I will kill the == operator.


- Jiang Yan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/#review28160
-----------------------------------------------------------


On Nov. 5, 2013, 12:18 a.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/14457/
> -----------------------------------------------------------
> 
> (Updated Nov. 5, 2013, 12:18 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
> Need to compare if the result passed in is the same as the stored value.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 
> 
> Diff: https://reviews.apache.org/r/14457/diff/
> 
> 
> Testing
> -------
> 
> Tested along with https://reviews.apache.org/r/13086/
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>


Re: Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/#review28160
-----------------------------------------------------------



3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
<https://reviews.apache.org/r/14457/#comment54776>

    I would prefer a more explicit syntax.
    
    When you want to create a Result instance which has a default value None(), here is the difference:
    
    Your way:
    Result result; // Default: None()
    
    More explicit way:
    Result result = None();
    
    I would prefer the latter one as it is more explicit.
    
    What do you think?



3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
<https://reviews.apache.org/r/14457/#comment54769>

    This semantics look weird to me, especially the error message string matching part.
    
    Can we modify the call-site to make the comparison more explicit, instead of relying on '==' operator. (BTW: Try does not have '==' defined). 


- Jie Yu


On Nov. 5, 2013, 12:18 a.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/14457/
> -----------------------------------------------------------
> 
> (Updated Nov. 5, 2013, 12:18 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
> Need to compare if the result passed in is the same as the stored value.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 
> 
> Diff: https://reviews.apache.org/r/14457/diff/
> 
> 
> Testing
> -------
> 
> Tested along with https://reviews.apache.org/r/13086/
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>


Re: Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

Posted by Jiang Yan Xu <ya...@jxu.me>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/
-----------------------------------------------------------

(Updated Nov. 5, 2013, 12:18 a.m.)


Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.


Changes
-------

BenM's


Repository: mesos-git


Description
-------

This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
Need to compare if the result passed in is the same as the stored value.


Diffs (updated)
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 

Diff: https://reviews.apache.org/r/14457/diff/


Testing
-------

Tested along with https://reviews.apache.org/r/13086/


Thanks,

Jiang Yan Xu


Re: Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/#review28150
-----------------------------------------------------------

Ship it!



3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
<https://reviews.apache.org/r/14457/#comment54758>

    Either:
    
    message == that.message
    or
    error() == that.error()


- Ben Mahler


On Oct. 3, 2013, 5:45 a.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/14457/
> -----------------------------------------------------------
> 
> (Updated Oct. 3, 2013, 5:45 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
> Need to compare if the result passed in is the same as the stored value.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 
> 
> Diff: https://reviews.apache.org/r/14457/diff/
> 
> 
> Testing
> -------
> 
> Tested along with https://reviews.apache.org/r/13086/
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>


Re: Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

Posted by Jiang Yan Xu <ya...@jxu.me>.

> On Oct. 4, 2013, 5:45 p.m., Vinod Kone wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp, line 30
> > <https://reviews.apache.org/r/14457/diff/1/?file=360811#file360811line30>
> >
> >     Why did you need this?

Without it for "Result" class variables I need to manually default-initialize each of them when NONE feels like a reasonable default. Any reason it should better not be added?


- Jiang Yan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/#review26677
-----------------------------------------------------------


On Oct. 3, 2013, 5:45 a.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/14457/
> -----------------------------------------------------------
> 
> (Updated Oct. 3, 2013, 5:45 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
> Need to compare if the result passed in is the same as the stored value.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 
> 
> Diff: https://reviews.apache.org/r/14457/diff/
> 
> 
> Testing
> -------
> 
> Tested along with https://reviews.apache.org/r/13086/
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>


Re: Review Request 14457: Added default constructor and ==, != operators for Result. (Stout)

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/14457/#review26677
-----------------------------------------------------------



3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
<https://reviews.apache.org/r/14457/#comment51963>

    Why did you need this?


- Vinod Kone


On Oct. 3, 2013, 5:45 a.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/14457/
> -----------------------------------------------------------
> 
> (Updated Oct. 3, 2013, 5:45 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Ben Mahler, and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> This is necessary for the master detector API: https://reviews.apache.org/r/13086/diff/#5
> Need to compare if the result passed in is the same as the stored value.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp f918f86ed2eb74e021a4b851b311517f3313ad10 
> 
> Diff: https://reviews.apache.org/r/14457/diff/
> 
> 
> Testing
> -------
> 
> Tested along with https://reviews.apache.org/r/13086/
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>