-
Notifications
You must be signed in to change notification settings - Fork 21
Description
@weefbellington from our team at Lyft has been working on serializing/deserializing Koptional values in JSON and we've stuck for some time discussing following use case:
Optional<Optional<T>> (and other levels of direct nesting).
This use case is weird on its own, however Koptional does nothing to prevent it (neither does Arrow btw), so it's a valid state for Koptional 1.x.
Right now we've decided to serialize/deserialize without enhancing JSON with additional metadata, which results in following convention for JSON:
Some(None) → NoneHowever, that creates difference between how we represent Some(None) in-memory vs JSON.
With all that in mind, I'd like to raise a discussion about this and propose following changeset for Koptional 2.x:
- Hide
Someconstructor - Expose a function named
Some(): Optional<T>that would returnNoneforSome(None)
cc @ming13 @dmitry-novikov @nostra13 @AlecStrong @Egorand