Replies: 2 comments 21 replies
-
Angle brackets have the advantage of being shorter than So, if
or only
? What about omitting the value altogether? Is that something you want to support, or rather require it to be explicit? Is
equal to
? |
Beta Was this translation helpful? Give feedback.
-
KDL doesn’t have static typing. Given that, I don’t think there’s any value to be gained in trying to mark a value as If you think about it, an optional type like |
Beta Was this translation helpful? Give feedback.
-
Because of the whole
billion dollar mistake
thing, I was thinking we could allow special syntax for KDL to specifically mark any Values as "nullable"/"Option" types. These can well be treated on de/serialization as actual nullable types in languages like JavaScript that support it, or they may be translated toOption
types in those that handle "absence" that way.My main reasoning for introducing this as explicit syntax is to allow the distinction to be made explicit by those who want to, such as certain target languages (like Rust!) or schema languages intended to be used with KDL, which may want to do static verification of a KDL schema.
My proposed syntax is this:
My intention is that in languages with null, which want to keep that logic, will represent
<>
asnull
, and<1>
as a completely unwrapped1
. Same thing for any level of wrapping, so<<<<1>>>>
would become1
in those languages. Likewise,<<<>>>
would just become a simplenull
. Languages or libraries which choose to go the "safe" route, though, will be able to represent these asSome(Some(Some(1)))
and such.What do y'all think?
Beta Was this translation helpful? Give feedback.
All reactions