From: Baptiste L. <bap...@gm...> - 2011-05-25 14:56:45
|
2011/5/25 Aaron Jacobs <ja...@go...> > Alright, I've implemented my understanding of the desired behavior in SVN > revision 216, documenting the change in NEWS.txt. > > A few questions: > > * Could you take a look at NEWS.txt and tell me whether you agree with > the > behavior? I made changes to the other isFoo methods to make them more > consistent and less surprising (for example, I don't know why null > returned true for isArray). > Concerning numeric it looks good. I'll make a more in depth review this evening. The behavior of isArray can be explained by the fact that a default constructed Value can be though of as either an empty array or an empty object: a nullValue is automatically "upgraded" to arrayValue or objectValue on first array access or member reference. There is no distinction in the (current) implementation between a default constructed value and a nullValue. This is that feature that allows the following usage: Json::Value array; array.append( 1234 ); Json::Value object; object["age"] = 1234; Maybe we should introduce a distinction between "default" initialization and "null", but I'm not sure how to go about that... > * It feels like now that these completely describe the safety of the > asFoo > methods, the isConvertibleTo method is redundant. It's also not > completely > descriptive, since it doesn't distinguish 64-bit integers. Should I > delete > it? We don't ever use it at Google, but I suppose this may be a problem > for other codebases. > It is best not to break the code unless we have to. We can mark it as deprecated and have the implementation forward to is* methods (64 variants for int). Notes that I have test failures on MSVS2010: 1> * Detail of ValueTest/integers test failure: 1> c:\perso\prg\vc\lib\jsoncpp-trunk\src\test_lib_json\main.cpp(626): double(kint64max) == val.asDouble() 1> c:\perso\prg\vc\lib\jsoncpp-trunk\src\test_lib_json\main.cpp(627): float(kint64max) == val.asFloat() 1> 16/17 tests passed (1 failure(s)) Do you know what could be the cause? Otherwise I'll investigate... There is also the problem of stdint.h which is not available before MSVS2010: src\test_lib_json\main.cpp(6) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory => I'll check exact usage and see how to solve this issue for portability. Baptiste. > > Aaron > |