mmalhotra commented on code in PR #3308:
URL: https://github.com/apache/avro/pull/3308#discussion_r1948103463


##########
lang/c++/impl/json/JsonDom.cc:
##########
@@ -177,5 +177,22 @@ std::string Entity::toString() const {
     return result;
 }
 
+std::string Entity::to_string() const {

Review Comment:
   @thiru-mg 
   Thanks for your comment.
   
   > It seems to do exactly the same as what toString, only a bit more 
efficiently.
   
   The existing `toString` in combination with `writeEntity` function treats 
the `Entity` like json even if it's one of the primitive types. For example, if 
the `Entity` had a `std::string` value of `1`, the `toString` would return 
`std::string` with value `\"1\"` instead of simply `1`. This causes several 
tests to fail which require it to be `1`.  `toString` is more like a dump 
function.
   
   > The name of the function is at variance with the style followed 
throughout: we use camelCase everywhere and this function uses snake_case.
   
   I was trying to name it similar to `std::to_string` function. However if the 
camelCase requirement is strict I can name this something like 
`toLiteralString` or  simply `repr`. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to