Replies: 12 comments 9 replies
-
Some feedback from Twitter:
|
Beta Was this translation helpful? Give feedback.
-
I am mixed on this:
|
Beta Was this translation helpful? Give feedback.
-
I do think this would make a lot of use-cases look a lot cleaner - a config I'm developing would certainly benefit somewhat from it. On the other hand, it makes KDL slightly more ambiguous. Limiting it to just idents, rather than the wide-open "anything that's not already another syntax" that YAML does, does significantly limit the possible damage - the only ambiguities are true/false/null and I suppose adjacent child nodes like Gankra pointed out. (Tho that latter case is ambiguous in the same way today if you use string nodenames, tho admittedly those are intentionally extremely rare.) As a big fan of unquoted attribute values in HTML, I think my ultimate vote is +1 on this. |
Beta Was this translation helpful? Give feedback.
-
I also think it makes configurations much cleaner. While I see strong consistency as very desireable (every string has quotes), for me the improved readbility would be more important. |
Beta Was this translation helpful? Give feedback.
-
I think this does make it more difficult for certain parsers: considering I agree that it can make certain DSLs look more clean and consistent. I also agree that it makes typos in keywords harder to detect, and would like to add that |
Beta Was this translation helpful? Give feedback.
-
Oh right I forgot to mention that it only kind of makes my DSL easier. I'm representing type declarations with rust-like syntax: struct "Point" {
x "u32"
y "u32"
} which would indeed be nicer as: struct Point {
x u32
y u32
} but I need full stringy fallback for delimiting nested/generic types: struct "Matrix<T>" {
vals "[[Option<T>; 10]; 10]"
} So having bare ident strings would make like, 95% of my cases nicer at the cost of making the remaining 5% even more weird/confusing. |
Beta Was this translation helpful? Give feedback.
-
Ambiguity is one of my chief problems with YAML. I was very happy when I came across KDL because it seemed to actively eschew these problems in favour of always being accurate. I also have concerns over the parsing like someone else raised. It would make it unnecessarily complicated. |
Beta Was this translation helpful? Give feedback.
-
Another argument in favor of this is that it lets you treat arguments as being value-less properties. That is, if you have (And just double-checking - yup, you can't today have a property name using the identifer |
Beta Was this translation helpful? Give feedback.
-
Already gave my +1 per reaction but I still think that this might be relevant: In my case I intend to have arguments to be able to link to the other nodes through their identifiers, and also add some operations to them (in the context of colors). For example, take this: cool-cyan "oklch(70% 0.098 181.69)"
accent cool-cyan
secondary accent - "25% lightness" This ^ would be so much cleaner to me than cool-cyan "oklch(70% 0.098 181.69)"
accent "cool-cyan"
secondary "accent" "-" "25% lightness" But to be honest, this is also a pretty obscure usecase, and probably kdl was not intended to be the basis for a whole weird DSL like this. Still, would be nice to have since almost every other aspect of kdl fits my case perfectly right now. |
Beta Was this translation helpful? Give feedback.
-
FWIW, I'm using KDL for a blueprinting system for games right now. Here's an example: https://github.com/gamma-delta/palkia/blob/main/tests/fabricator/simple.rs Having quoteless strings in these cases would be really handy, especially when the thing I'm deserializing is logically an identifier and not a string. (This is also why I'd like forward-slash to be allowed in identifiers, to logically group similar blueprints together. Currently I'm settling for things like In a perfect magic world I'd like these quoteless strings to be a new "identifier" type, but that's probably just my Lisp brainrot talking. |
Beta Was this translation helpful? Give feedback.
-
i prefer KDL’s existing behaviour because i think having the value syntax be a superset of the identifier syntax makes things more confusing for downstream specifications which might want behaviours for one but not the other. right now KDL has:
there's some confusion between identifier-the-syntax and identifier-the-concept but it's largely able to be handwaved because the former only appears in the latter case however i think if a downstream specification wanted to specify special rules for identifiers (the concept), a lot of people would expect those behaviours anywhere identifiers (the syntax) are allowed. because the value syntax becomes a superset of the identifier syntax, people will expect value behaviours to be a superset of identifier behaviours. but there's lots of reasons (i think) why you would want strings in values not to behave like identifiers and just to behave like strings. this opens the door to people asking: why not just let node names be any kind of value? why do property keys always have to be strings? right now it's clear that identifiers and values are different concepts that just happen to share a syntax in the complex case, but this becomes a lot less clear when every identifier is also a value. anyway. this is maybe not a problem for KDL itself, but i think worth considering |
Beta Was this translation helpful? Give feedback.
-
I'm of the mind right now that this is valuable enough for a human-centered configuration language that we should go ahead and do it, regardless of the identified footguns. I've made an issue for KDL 2.0 here, which folks are welcome to upvote/downvote as needed. |
Beta Was this translation helpful? Give feedback.
-
I was looking at kdl-org/kdl-rs#58 and it made me think that maybe I should get over my stubbornness/aversion about allowing plain identifiers anywhere strings are allowed, just as we allow strings anywhere identifiers are allowed.
The reasoning being that, not just with the above example, but several other early KDL users have used it for simple DSLs for various purposes, and one of the things that always stood out about those DSLs was that a lot of things had to be strings that would look way better (and be easier to read), if they were simply identifiers.
This kind of thing isn't entirely without precedent. Many, if not most, configuration languages support unquoted string values, including YAML itself. But there's also a part of me that's a bit resistant because of potential confusion it might cause when someone's trying to figure out if they're able to use a plain identifier. But that's not a good argument against it because they already have to do that for other identifiers, like node names.
What do y'all think? This would be something we could get into the KDL 2.0 spec, and I think has some good potential.
Beta Was this translation helpful? Give feedback.
All reactions