Re: Tag Spec
Oren Ben-Kiki <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CADJiDhspKQHhdPbk0wnRsWFPZv4xs2gYm1buX226A_WeDtCKmA@mail.gmail.com> |
Using `/` for indicating a global tag would go against writing stuff like `!ruby/sym` (I hesitate to mention this given the latest issues with this being a security loophole... but anyway). The current rules were intentionally designed to promote the use of suffixes. Using !<...> is intentionally ugly. You "should not", in general, specify full URIs unless under special circumstances. The idea is that you "should" use suffixes and isolate the full-URI prefixes in there. Whether or not this intent is "correct", it is what it is. Getting rid of `!<...>` and replacing it with a rule saying "is a complete URI if it contains :, is a suffix otherwise" - hmmm. I'm not convinced, but there might be something in it. Either way, this is be YAML 2 material. Have fun, Oren Ben-Kiki On Sun, Feb 3, 2013 at 9:39 PM, Trans <[email protected]> wrote: > > On Sun, Feb 3, 2013 at 1:31 PM, Oren Ben-Kiki <[email protected]>wrote: > >> The question isn't one of ease of parsing (we all know YAML isn't easy to >> parse :-). >> > > :-) Indeed! > > It is a matter of ambiguity. The !<verbatim> syntax was added very late >> in the game, to allow avoiding the tag prefix games. >> > >> > The thinking isn't "domain" vs. "local", the thinking is "full arbitrary >> URI" (inside <...>) vs. "suffix added to some arbitrary URI prefix" >> (without the <...>). The difference between "!", "!!" and "!foo!" is just >> "which URI prefix should we use here". >> > > Though in practice that's what people see. Perhaps the better terminology > is "globally unique" vs "local" tags. Although determining if a prefix is > applied would depend on whether the tag contains a `:` or not, sticking > with current spec, !<...> tags would still not resolve. To clarify the > difference: > > %TAG ! tag:foo.org/ > --- > - !foo => !<tag:foo.org/foo> > - !tag:bar.org/bar => !<tag:bar.org/bar> > > Also, I think this would open up `!<foo>` to be a legal local tag, rather > then the degenerate global tag it is now b/c it is not a valid URI. So, > without a `%TAG !` directive: > > --- > - !foo => !<foo> > > So the `!` would no longer have any significance if a tags *name*. It > would be used only to designate a tag and to sub prefixes, but a local tag > would not need to be `!foo` any more, just `foo`. > > If we said "we don't attach any prefix if what follows the "!" looks like >> a complete URI" we'd be entering a world of pain. URIs can be in all sort >> of forms: "urn:isbn:0-395-36341-1" is a URI and hence (if someone >> wanted) !<urn:isbn:0-395-36341-1> would be a valid (if somewhat insane) >> tag. So "looking like a complete URI" isn't really easy to define. "Looking >> like a tag URI" is well-defined, but YAML really doesn't insist on using >> "tag URIs", even though we call the "node type tags", well, tags. >> > > I'm not seeing how this translates into be a world of pain. Keeping it > simple, as in "does it contain a `:`" should suffice b/c `:` is required of > a valid URI. Local tags can live without them. Some adjustment might be > required by end users in rare cases. Like your example, they could use !< > urn:isbn#0-395-36341-1>. I don't think it's too much to ask of end-users > that local tags not use `:`. (If it really is too much to ask then perhaps > a different escape notion could be allowed, e.g `![urn:isbn:0-395-36341-1 > ]`. > > (Note, before I suggested that `/` be an indicator of global tag too. In > that case if no `:` is present, `tag:` would be assumed. That just seemed > like a nice convenience, but it is not necessary.) > > ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ Yaml-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yaml-core