#2 YAML as main document format

已關閉
caryoscelus7 年之前創建 · 4 條評論

Before this is implemented, we need to specify anchoring and importing mechanisms (that's why we have current JSON+UUID abomination).

Before this is implemented, we need to specify anchoring and importing mechanisms (that's why we have current JSON+UUID abomination).
caryoscelus 評論 7 年之前'
所有者

Since YAML does not preserve map ordering, we might have to use list+map scheme (http://yaml.org/type/omap.html) because lack of ordering will make documents badly suited for manual editing.

Unlike JSON, YAML provides tags and anchors, so we may do away with "TYPE" and UUIDs. Although as for ids, it is a bit questionable. How should we link to nodes inside other files? Should it be via separate "naming node" mechanism or should it use anchors?

Since YAML does not preserve map ordering, we might have to use list+map scheme (http://yaml.org/type/omap.html) because lack of ordering will make documents badly suited for manual editing. Unlike JSON, YAML provides tags and anchors, so we may do away with "TYPE" and UUIDs. Although as for ids, it is a bit questionable. How should we link to nodes inside other files? Should it be via separate "naming node" mechanism or should it use anchors?
caryoscelus 評論 6 年之前'
所有者

For now, lets postpone final decision on external linking, but assume that it can be implemented with "naming nodes" and so we do not need uuids for that reason. However, we might still want uuids to generate consistent anchors..

For now, lets postpone final decision on external linking, but assume that it can be implemented with "naming nodes" and so we do not need uuids for that reason. However, we might still want uuids to generate consistent anchors..
caryoscelus 評論 6 年之前'
所有者

Bah, there seems to be no C/C++ yaml library that would support comment and anchor preservation.

Possible solutions:

  1. write yaml parser/emitter (requires lots of work)
  2. fix issues and use fixed parser/emitter
  3. use additional filter step when saving file (quite complicated: to preserve comments: diff old and new versions and undo whitespace/comment changes; to preserver anchors: parse with anchor-preserving parser and replace??)
  4. accept lack of preservation

Anchor preservation is actually more important because lack of it would mean constant changes of file that would produce noise in diffs.

Lack of comment preservation only means that human readability/writeability is reduced, but even then comments might be embedded into nodes at some point. And also solution 3 is much easier to implement for comments.

Bah, there seems to be no C/C++ yaml library that would support comment and anchor preservation. - <https://github.com/jbeder/yaml-cpp/issues/110> - <https://github.com/jbeder/yaml-cpp/issues/457> - <https://github.com/yaml/libyaml/issues/42> Possible solutions: 1. write yaml parser/emitter (requires lots of work) 1. fix issues and use fixed parser/emitter 1. use additional filter step when saving file (quite complicated: to preserve comments: diff old and new versions and undo whitespace/comment changes; to preserver anchors: parse with anchor-preserving parser and replace??) 1. accept lack of preservation Anchor preservation is actually more important because lack of it would mean constant changes of file that would produce noise in diffs. Lack of comment preservation only means that human readability/writeability is reduced, but even then comments might be embedded into nodes at some point. And also solution 3 is much easier to implement for comments.
caryoscelus 評論 6 年之前'
所有者

Ok, yaml-cpp seems to be easily fixable (anchor part), so lets use it for now.

Ok, yaml-cpp seems to be easily fixable (anchor part), so lets use it for now.
caryoscelus 在代碼提交 6 年之前 中引用了該問題
caryoscelus 在代碼提交 6 年之前 中引用了該問題
登入 才能加入這對話。
正在加載...
取消
保存
尚未有任何內容