-----------------------------------------------------------
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

Reply via email to