You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After refactoring some code from putting data into an ujson.Obj to directly updating the underlying LinkedHashMap we were left with code like this:
val j = mutable.LinkedHashMap[String, ujson.Value]()
j.value.put("n", ujson.Str(name))
ujson.Obj(j)
It compiles without warnings but the n field never makes it into the object. The unnecessary .value call which got the underlying map from the previously used Obj now triggers an implicit conversion that copies the map:
The new entry is only written into the copy and immediately discarded.
I'm not sure what the right solution is. Clearly .value is necessary. The implicit conversion could be removed but it may make the API harder to use in some cases.
The text was updated successfully, but these errors were encountered:
After refactoring some code from putting data into an
ujson.Obj
to directly updating the underlyingLinkedHashMap
we were left with code like this:It compiles without warnings but the
n
field never makes it into the object. The unnecessary.value
call which got the underlying map from the previously used Obj now triggers an implicit conversion that copies the map:The new entry is only written into the copy and immediately discarded.
I'm not sure what the right solution is. Clearly
.value
is necessary. The implicit conversion could be removed but it may make the API harder to use in some cases.The text was updated successfully, but these errors were encountered: