3 ms·
The problem is insufficiently analysed by the article author and the commenters in this thread so far. It is very superficial. The recent thread "Can’t use iClo
by bmn__ 6y ago
The problem is insufficiently analysed by the article author and the commenters in this thread so far. It is very superficial. The recent thread "Can’t use iCloud with “true” as the last name" https://news.ycombinator.com/item?id=26364993 https://news.ycombinator.com/item?id=26364993 went deeper. Let me take up its relevant particulars into this thread.
The article author hitchdev does not say it outright, but it is heavily implied that the YAML file was edited by hand. This is the immediate cause of the problem. The indirect root of the problem is that the spec authors chose a plain text serialisation format and thus created an affordance http://enwp.org/Affordance#As_perceived_action_possibilities http://enwp.org/Affordance#As_perceived_action_possibilities to be edited by hand.
This turns out the be unsafe/source of bugs because YAML end-users are not capable of correctly applying the serialisation rules considering the edge cases detailed in the article because humans are creatures of habit, applying analogy and common sense, making assumptions and then sometimes go wrong, whereas a piece of software will not make the Norway, Null etc. mistakes. hitchdev even writes that quoting the string is "a fix for sure, but kind of a hack", but that's a grave misunderstanding. Quoting the string here is actually applying the serialisation rules correctly.
The tangential at the end of the article about typing is also orthogonal/irrelevant. YAML is strictly/strongly/unambiguously typed, and so is the mentioned variant Strict YAML. The difference is that Strict YAML has serialisation rules that are more amenable to or aligning with the human factors of habit etc. and thus work better in practice.
My personal recommendation is to never edit YAML by hand and always use a serialiser. This is less convenient, but safe.
In closing, I would like the reader of this comment to make an effort to distinguish between "what is" and "what ought to be" in their head, otherwise the ideas here will be very muddled.
- dragonwriter 6y ago> The problem is insufficiently analysed by the article author The article author also misidentifies the version of the YAML spec (calling it 2.0, which doesn’t exist; the behavior is from YAML 1.1, and this class of problems motivated a bunch of changes in YAML 1.2, which has been out since 2009.) But the article author isn’t trying to analyze the problem, he’s trying to rationalize why what is notionally a YAML-processing library just ignores the spec.
- Aeolun 6y ago> never edit YAML by hand and always use a serialiser I don’t follow this. If yaml is your config format, and you are not editing it by hand, what are you editing?
- bmn__ 6y agoI work on the deserialisation. This is a one-liner in many programming languages.
- sfvisser 6y agoThe problem is not 'someone is not correctly following the serialization rules', the problem is 'the serialization rules are quite terrible'. This is not some interesting trade-off, this problem is fixable on all axes by using non-ambiguous, non-overloaded typing rules for your config format. Even JSON and XML got this right.
- bmn__ 6y ago> The problem is not 'someone is not correctly following the serialization rules' Yes, yes, I pointed that out. grep "immediate cause" and "indirect root" > the serialization rules are quite terrible Did that need to be said explicitly? I agree FWIW. I have already made a value judgement mildly against YAML, in case that's not clear. It's only mild because the problem can be worked around. I think this approach is more practical than moving the whole world over to a completely different thing. > problem is fixable […] non-ambiguous […] rules Is the implication here that you say YAML is ambiguous? It's not. I don't want sloppy analysis. To be precise, the ambiguity is imagined, it does not exist on the spec or software level, only in the head of people.
- atleta 6y agoThe very point of yaml is that it is easy to edit by hand. If you use an, I suppose, GUI editor then you don't need yaml. You could use any strictly typed serialization format. (Self describing or with a schema.)