Hacker News new | ask | show | jobs
by jonhohle 3715 days ago
> It will complicate processing.

In practice, it doesn't. If you want to know if an IonValue is null, ask it with #isNull. If you don't care about the null's type, ignore it. On the other hand, the type is an additional form of metadata which allows overloading the meaning of a value.

nulls can also be annotated, so Ion doesn't really have the concept of a singular shared null sentinel.

More so than JSON, Ion often uses nulls to differentiate presence from value (that is, the lack of a field in a struct has a different meaning the presence of that field with a null value). Since nulls are objects, they can be tested separately from the lack of a field definition.

> a timestamp is clearly an aggregate and should be understood as corresponding to some structure type.

Timestamps are structured types with a literal representation that is explicitly modeled in the specification. You're free to ignore it and use a custom schema for representing time, but you've moved any validation into your application at that point and are no better off than JSON.

1 comments

I think the concern is that if you take an IonValue and cast it to IonText, then call stringValue(), you'll get an exception somewhere if the document contained a null value.

It recalls the nullability arguments between the ML family and the C/Java family.

kazinator is asking for safer document semantics and a type-safe API.