You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Charlie Carson <ch...@gmail.com> on 2014/02/04 22:41:20 UTC

Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

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

(Updated Feb. 4, 2014, 9:41 p.m.)


Review request for mesos, Benjamin Hindman and Jeff Currier.


Bugs: https://issues.apache.org/jira/browse/MESOS-939
    https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939


Repository: mesos-git


Description
-------

    Add JSON::Boolean to stout/json.hpp.

    If you assign an JSON::Object a bool then it will get coerced into
    a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
    and JSON::False do not have constructors from bool.

    The fix is to introduce a common super class, JSON::Boolean, which
    both JSON::True and JSON::False inherit from.  JSON::Boolean has the
    necessary constructor which takes a bool.

    However, this leads to ambiguity when assigning a cstring to
    a JSON::Value, since JSON::String already takes a const char * and
    a const char * is implicitly convertable to a bool.

    The solution for that is to rename the variant from JSON::Value
    to JSON::inner::Variant and to create a new class JSON::Value
    which inherits from JSON::inner::Variant.  The new JSON::Value
    can have all the conversion constructors in a single place, so
    is no ambiguity, and delegate everythign else to the Variant.

    Also added a bunch of unit tests.

    SEE: https://issues.apache.org/jira/browse/MESOS-939

    Review: https://reviews.apache.org/r/17520


Diffs (updated)
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
  3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 

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


Testing
-------

make check + new unit tests


Thanks,

Charlie Carson


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Jeff Currier <jc...@twitter.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17520/#review33643
-----------------------------------------------------------

Ship it!


Ship It!

- Jeff Currier


On Feb. 4, 2014, 9:41 p.m., Charlie Carson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2014, 9:41 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Jeff Currier.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
>     Add JSON::Boolean to stout/json.hpp.
> 
>     If you assign an JSON::Object a bool then it will get coerced into
>     a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
>     and JSON::False do not have constructors from bool.
> 
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
> 
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
> 
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
> 
>     Also added a bunch of unit tests.
> 
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
> 
>     Review: https://reviews.apache.org/r/17520
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
>   3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 
> 
> Diff: https://reviews.apache.org/r/17520/diff/
> 
> 
> Testing
> -------
> 
> make check + new unit tests
> 
> 
> Thanks,
> 
> Charlie Carson
> 
>


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Charlie Carson <ch...@gmail.com>.

> On Feb. 20, 2014, 12:14 a.m., Dominic Hamon wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp, line 102
> > <https://reviews.apache.org/r/17520/diff/2/?file=469354#file469354line102>
> >
> >     consider making this (and the other single parameter constructors in this file) explicit.

the design goal for the existing class was to allow implicit assignment.


- Charlie


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


On Feb. 4, 2014, 9:41 p.m., Charlie Carson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2014, 9:41 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Jeff Currier.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
>     Add JSON::Boolean to stout/json.hpp.
> 
>     If you assign an JSON::Object a bool then it will get coerced into
>     a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
>     and JSON::False do not have constructors from bool.
> 
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
> 
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
> 
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
> 
>     Also added a bunch of unit tests.
> 
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
> 
>     Review: https://reviews.apache.org/r/17520
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
>   3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 
> 
> Diff: https://reviews.apache.org/r/17520/diff/
> 
> 
> Testing
> -------
> 
> make check + new unit tests
> 
> 
> Thanks,
> 
> Charlie Carson
> 
>


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Dominic Hamon <dh...@twopensource.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17520/#review34952
-----------------------------------------------------------



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65349>

    consider making this (and the other single parameter constructors in this file) explicit.



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65350>

    typo: recursive_wrapper


- Dominic Hamon


On Feb. 4, 2014, 1:41 p.m., Charlie Carson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2014, 1:41 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Jeff Currier.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
>     Add JSON::Boolean to stout/json.hpp.
> 
>     If you assign an JSON::Object a bool then it will get coerced into
>     a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
>     and JSON::False do not have constructors from bool.
> 
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
> 
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
> 
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
> 
>     Also added a bunch of unit tests.
> 
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
> 
>     Review: https://reviews.apache.org/r/17520
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
>   3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 
> 
> Diff: https://reviews.apache.org/r/17520/diff/
> 
> 
> Testing
> -------
> 
> make check + new unit tests
> 
> 
> Thanks,
> 
> Charlie Carson
> 
>


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Charlie Carson <ch...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17520/
-----------------------------------------------------------

(Updated Feb. 20, 2014, 8:54 p.m.)


Review request for mesos, Benjamin Hindman and Jeff Currier.


Changes
-------

rebase from master 
switched back to optional parameter for SFINAE


Bugs: https://issues.apache.org/jira/browse/MESOS-939
    https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939


Repository: mesos-git


Description
-------

    Add JSON::Boolean to stout/json.hpp.

    If you assign an JSON::Object a bool then it will get coerced into
    a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
    and JSON::False do not have constructors from bool.

    The fix is to introduce a common super class, JSON::Boolean, which
    both JSON::True and JSON::False inherit from.  JSON::Boolean has the
    necessary constructor which takes a bool.

    However, this leads to ambiguity when assigning a cstring to
    a JSON::Value, since JSON::String already takes a const char * and
    a const char * is implicitly convertable to a bool.

    The solution for that is to rename the variant from JSON::Value
    to JSON::inner::Variant and to create a new class JSON::Value
    which inherits from JSON::inner::Variant.  The new JSON::Value
    can have all the conversion constructors in a single place, so
    is no ambiguity, and delegate everythign else to the Variant.

    Also added a bunch of unit tests.

    SEE: https://issues.apache.org/jira/browse/MESOS-939

    Review: https://reviews.apache.org/r/17520


Diffs (updated)
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 8b64e89e0b10f41878c84939cbb402a101324181 
  3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp aafaaa6f8c9ac1bd5037ca39983533ab79cae079 

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


Testing
-------

make check + new unit tests


Thanks,

Charlie Carson


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Charlie Carson <ch...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17520/
-----------------------------------------------------------

(Updated Feb. 20, 2014, 12:21 a.m.)


Review request for mesos, Benjamin Hindman and Jeff Currier.


Changes
-------

uploaded WIP fixes.  this doesn't compile (so don't commit it), but I wanted to upload what I was trying to do in case I missed something simple.


Bugs: https://issues.apache.org/jira/browse/MESOS-939
    https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939


Repository: mesos-git


Description
-------

    Add JSON::Boolean to stout/json.hpp.

    If you assign an JSON::Object a bool then it will get coerced into
    a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
    and JSON::False do not have constructors from bool.

    The fix is to introduce a common super class, JSON::Boolean, which
    both JSON::True and JSON::False inherit from.  JSON::Boolean has the
    necessary constructor which takes a bool.

    However, this leads to ambiguity when assigning a cstring to
    a JSON::Value, since JSON::String already takes a const char * and
    a const char * is implicitly convertable to a bool.

    The solution for that is to rename the variant from JSON::Value
    to JSON::inner::Variant and to create a new class JSON::Value
    which inherits from JSON::inner::Variant.  The new JSON::Value
    can have all the conversion constructors in a single place, so
    is no ambiguity, and delegate everythign else to the Variant.

    Also added a bunch of unit tests.

    SEE: https://issues.apache.org/jira/browse/MESOS-939

    Review: https://reviews.apache.org/r/17520


Diffs (updated)
-----

  3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
  3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 

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


Testing
-------

make check + new unit tests


Thanks,

Charlie Carson


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Benjamin Hindman <be...@berkeley.edu>.

> On Feb. 19, 2014, 8:52 p.m., Benjamin Hindman wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp, line 159
> > <https://reviews.apache.org/r/17520/diff/2/?file=469354#file469354line159>
> >
> >     I definitely prefer the SFINAE approach to the last one! Can we make this a default template parameter instead though? This has been the convention with SFINAE in libprocess (although there is a rather small footprint of SFINAE), and we've used function parameters to further disambiguate beyonod SFINAE (see Prefer/LessPrefer future.hpp in libprocess).
> 
> Charlie Carson wrote:
>     Ben - I tried to do that and I got a compiler error "error: default template arguments may not be used in function templates".  I'm using :
>     [tw-mbp13-ccarson.local Wed Feb 19 01:40:29 (fixJSONbool) ~/mesos/build]$>g++ --version
>     i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
>     
>     am I using the wrong version of C++ or should I wrap it in #if {C++11} ?

Ah, this is my bad, let's just go back to using a default function parameter, but please put a space around the '='. Thanks Charlie!


- Benjamin


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


On Feb. 20, 2014, 12:21 a.m., Charlie Carson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
> 
> (Updated Feb. 20, 2014, 12:21 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Jeff Currier.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
>     Add JSON::Boolean to stout/json.hpp.
> 
>     If you assign an JSON::Object a bool then it will get coerced into
>     a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
>     and JSON::False do not have constructors from bool.
> 
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
> 
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
> 
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
> 
>     Also added a bunch of unit tests.
> 
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
> 
>     Review: https://reviews.apache.org/r/17520
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
>   3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 
> 
> Diff: https://reviews.apache.org/r/17520/diff/
> 
> 
> Testing
> -------
> 
> make check + new unit tests
> 
> 
> Thanks,
> 
> Charlie Carson
> 
>


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Charlie Carson <ch...@gmail.com>.

> On Feb. 19, 2014, 8:52 p.m., Benjamin Hindman wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp, line 159
> > <https://reviews.apache.org/r/17520/diff/2/?file=469354#file469354line159>
> >
> >     I definitely prefer the SFINAE approach to the last one! Can we make this a default template parameter instead though? This has been the convention with SFINAE in libprocess (although there is a rather small footprint of SFINAE), and we've used function parameters to further disambiguate beyonod SFINAE (see Prefer/LessPrefer future.hpp in libprocess).

Ben - I tried to do that and I got a compiler error "error: default template arguments may not be used in function templates".  I'm using :
[tw-mbp13-ccarson.local Wed Feb 19 01:40:29 (fixJSONbool) ~/mesos/build]$>g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

am I using the wrong version of C++ or should I wrap it in #if {C++11} ?


- Charlie


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


On Feb. 4, 2014, 9:41 p.m., Charlie Carson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2014, 9:41 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Jeff Currier.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
>     Add JSON::Boolean to stout/json.hpp.
> 
>     If you assign an JSON::Object a bool then it will get coerced into
>     a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
>     and JSON::False do not have constructors from bool.
> 
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
> 
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
> 
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
> 
>     Also added a bunch of unit tests.
> 
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
> 
>     Review: https://reviews.apache.org/r/17520
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
>   3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 
> 
> Diff: https://reviews.apache.org/r/17520/diff/
> 
> 
> Testing
> -------
> 
> make check + new unit tests
> 
> 
> Thanks,
> 
> Charlie Carson
> 
>


Re: Review Request 17520: Add JSON::Boolean to stout/json.hpp.

Posted by Benjamin Hindman <be...@berkeley.edu>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17520/#review34924
-----------------------------------------------------------

Ship it!



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65302>

    s/inner/internal/



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65303>

    You can kill the '_' prefix in all of the constructors since we aren't setting a 'value'.



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65305>

    Space between 'template' and '<' please.



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65304>

    I definitely prefer the SFINAE approach to the last one! Can we make this a default template parameter instead though? This has been the convention with SFINAE in libprocess (although there is a rather small footprint of SFINAE), and we've used function parameters to further disambiguate beyonod SFINAE (see Prefer/LessPrefer future.hpp in libprocess).



3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
<https://reviews.apache.org/r/17520/#comment65306>

    Space between 'template' and '<' please.


- Benjamin Hindman


On Feb. 4, 2014, 9:41 p.m., Charlie Carson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2014, 9:41 p.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Jeff Currier.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
>     Add JSON::Boolean to stout/json.hpp.
> 
>     If you assign an JSON::Object a bool then it will get coerced into
>     a JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True
>     and JSON::False do not have constructors from bool.
> 
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
> 
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
> 
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
> 
>     Also added a bunch of unit tests.
> 
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
> 
>     Review: https://reviews.apache.org/r/17520
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp 3148a7873397f6b0b2ebdbff3b640535ccd12318 
>   3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp 29ada8a4a0396f889eb2583c3b3ff622050125af 
> 
> Diff: https://reviews.apache.org/r/17520/diff/
> 
> 
> Testing
> -------
> 
> make check + new unit tests
> 
> 
> Thanks,
> 
> Charlie Carson
> 
>