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
I see that the library is using structs to encapsulate strings. The types are public, so nobody will stop the consumers from calling the default constructor and, in consequence, entering a bad state.
I'm not sure I have a good answer here. I was thinking along the lines of following in the footsteps of JsonElement, which is a struct. Not sure I thought through it enough.
I'll explore this and see what changes are easily supported.
I see that the library is using structs to encapsulate strings. The types are public, so nobody will stop the consumers from calling the default constructor and, in consequence, entering a bad state.
Example from here: https://github.com/gregsdennis/json-everything/blob/master/JsonPointer/PointerSegment.cs
What is the benefit of using a struct instead of class here? The encapsulated string will end up on the heap anyway?
Classes would disallow the use of default constructor, which in consequence would enforce correctness
The text was updated successfully, but these errors were encountered: