#2 YAML as main document format

Slēgta
caryoscelus atvēra 7 gadi atpakaļ · 4 komentāri

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 komentēja 7 gadi atpakaļ
Īpašnieks

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 komentēja 6 gadi atpakaļ
Īpašnieks

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 komentēja 6 gadi atpakaļ
Īpašnieks

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 komentēja 6 gadi atpakaļ
Īpašnieks

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 pieminēja šo problēmu revīzijā 6 gadi atpakaļ
caryoscelus pieminēja šo problēmu revīzijā 6 gadi atpakaļ
Pierakstieties, lai pievienotos šai sarunai.
Notiek ielāde...
Atcelt
Saglabāt
Vēl nav satura.