Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified YAML and Tag Annotations #2

Open
trans opened this issue Aug 5, 2012 · 2 comments
Open

Simplified YAML and Tag Annotations #2

trans opened this issue Aug 5, 2012 · 2 comments

Comments

@trans
Copy link
Member

trans commented Aug 5, 2012

Thinking about simplification, perhaps a simplified variation of YAML could be made that lacks tags altogether, and then modify the current serializable specification to handle tags as annotated comments.

Example of simplified YAML:

---
foo: 1
bar: 2

Then YAML 2.0 could handle tags like so:

--- #! tag:foo.org/foobar,2012
foo: 1
bar: 2

Yet it would remain parseable with the simplified YAML b/c simplified YAML would just ignore the tags as comments.

The only tricky part here is that inline tags would make the whole line look like a comment. So either a bracketed notation would be needed in this case or a tags could be suffixed instead, or both e.g.

---
foo: #(int) 1

Or

---
foo: 1 #!int

Or

---
foo: 1 #(int)

Directives too would be annotated comments.

# %TAG !foo! foo.org,2012
@tanriol
Copy link

tanriol commented Aug 5, 2012

What is the reason for radically modifying the syntax? Wouldn't it be possible to just allow a "simplified" parser to ignore tags and resolve every node according to its type only?

@trans
Copy link
Member Author

trans commented Aug 5, 2012

In a round about way you've hit the nail on the head. The main reason to consider a Simplified YAML specification are the parser implementations. Consider the proliferation JSON implementations compared to YAML, and the fact that almost all reasonably complete YAML implementations are bindings to LibYAML --despite YAML being around for much longer. Clearly there is a complexity to the YAML specification that makes it difficult to implement.

So this issue is an exploration of one possibility for what might be done to improve upon this situation. In particular, tags account for one of the complexities that adds to the burden of implementers, while being one the features of YAML that has a broad set of use cases in which they are never used.

The reason I suggest using comments is b/c a Simplified YAML specification should not have to even think about tags. If you have to add conditions to the spec to ignore them, then you've already taken them, at least in part, into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants