Replies: 2 comments 5 replies
-
I'd argue the NOrway problems stems from premature casting (in no situation should In the first place YAML has a lot of aliases:
^ The above are just some instances I've encountered and make for some pretty confusing situations I'd have no problem with bare identifiers if it wasn't for the sake of it eventually leading to: why can't [some other arbitrary identifier] be treated as [specific keyword] and or [value]; which eventually snowballs as all kinds of new pseudo keywords get added to the language which may or may not break existing bare identifiers. In a similar vein, adding per-file or even parser configuration only further complicates the implementation as is, I'd rather one parser do one thing (to spec) and that alone, rather than a parser that can do all kinds of things based on some arcane flag(s) or special values in the file. Because what happens when an older parser is missing these flags and ends up just ignoring them? If someone really wants bare identifiers, I'd prefer it be treated as a separate dialect of KDL to make it perfectly clear that it's not standard, therefore developers can choose to build their parsers around the core without fear of some special dialect being missing in their implementation.
In the above case, it would be clear, if you see a file with the As an example, kuddle (my elixir implementation of KDL) can support bare identifiers I just have an extra step that identifies them and errors immediately to remain within spec. |
Beta Was this translation helpful? Give feedback.
-
I'm fairly against this sort of config switch. I'm also the author of Bikeshed, which does have a jillion little config switches, several of which affect parsing, so I'm not against the concept of parser switches in general. But there's a big difference between a document language and a data language - the latter is a lot more likely to have things copy-pasted between files/snippets, for instance. Also, a document language is mostly plain text (and HTML, in the case of Bikeshed), so there's just less opportunity for any given chunk of copy-pasted content to have anything affected by the parser switches, whereas data languages are usually dense with those opportunities. So having any given piece of the document be affected by parsing switches at the very beginning of the document ends up being a footgun; people have to remember to either copy over the parser switches as well, or modify the text to use the destination's parser config rules. (This is separate from any discussion about particular parsing discussions, like allowing bare strings.) |
Beta Was this translation helpful? Give feedback.
-
There are a few options with various trade-offs between readability and ambiguity (e.g., allow unquoted strings risks some kind of NOrway problem) and no one generally correct answer.
I was wondering whether one solution could be to offer flexibility at the file level with the first node per document (with a special reserved node name,
kdl
in this example)then this indicator would specify in this example whether unquoted strings are allowed or not (with the defaults staying conservative like they're now).
So people willing to accept the risk of extra ambiguity, but have cleaner configs, could simply add
bare_string=true
at the topBeta Was this translation helpful? Give feedback.
All reactions