Replies: 1 comment 6 replies
-
Annotations on values have well-defined meaning; the value holds the "value" and the annotation gives "type" information. We've got a lot of built-in value annotations that enforce this meaning. But KDL intentionally does not assign meaning to annotations on nodes. Partly this is because nodes are much more free-form than individual values, but it's also partly because the semantics can reasonably be different. Node names usually indicate the "type" of the node (this is the main benefit of a node-based language, after all, over the anonymous-object model of JSON), with the attribute/properties/children forming the "value". The annotation, then, isn't needed to indicate the type, and is free to be used to indicate other information. In particular, the usage you're noting is giving the child list, which is otherwise purely an indexed list of values akin to a node's attributes, the ability to act like a key/value list, akin to a node's properties. In other words, Such an example could be written in other ways, of course; for example, |
Beta Was this translation helpful? Give feedback.
-
In KDL, type annotations like
(u8)122
make sense, but the specification uses some examples that seem backwards, like(published)date
. Seems odd, as the field should be published! Even weirder when you consider thatdate
is a defined type in KDL, so why not(date)published
? It makes more sense to do that, since its a "published" field, that should be interprited as a date. Because of that it also seems inconsistant in examples when its used as more of a key with the node name indicating type, or when the node name indicates key and the annotation indicates type.Can someone explain why it is done this way? Or, if there isn't a good reason, maybe the semantics should be changed for KDL 2?
Beta Was this translation helpful? Give feedback.
All reactions