Re: utf8u tag proposal

William Spitzak <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Osamu TAKEUCHI wrote:

> Another concern is about the node's equality.
> I would like to have the next two nodes equal to each other.
> - !!utf8a "a"
> - "a"
> 
> But, in the current proposal, they will not be equal.

I agree with Osamu that this is a huge problem with the current proposal 
and design of YAML.

If I want to obey strict YAML rules, I would have to put !!utf8u in 
front of EVERY string, whether it had valid UTF-8 in there or not. I 
only want to use the tag if in fact there is invalid UTF-8 in the 
string, but assuming some other program does not agree with what is 
"valid" then it may produce unequal data for no good reason.

I suspect "!!binary" has worse problems in that it is even more likely 
to have different types, and users are forced to embed the type into the 
binary data, where other yaml processors cannot see or use it.

In any case you have to realize that both of these tags are wanted as 
another method of quoting strings. Just like whether a string is flow or 
quoted does not enter into it's equality, this should not either.

Therefore some ability to make multiple tags, some of which only control 
the encoding, and others which are both encoding and type, are needed.

My proposal was "!!taga !!tagb ...", and I guess I implied that if there 
are more than 1 the last one (at least) is an encoding-only tag.

> It can be an 
> option to treat the next two to be equal,
> though it is incompatible to the current definition.
> 
> - !!str#utf8a "a"
> - "a"

This is interesting except if you want to be compatible '#' cannot be 
used. Tags can only have these punctuation marks:

  '_', '-', ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '.', '!', 
'~', '*', '\'', '(', ')', '[', ']'

You could select two, one for normal tags and one for encoding-only 
ones. Maybe '!' for normal and '?' for encoding-only, and replace the 
leading '!' with it as well, so in normal use the proposed tag would be 
written as "!?utf8u".

> Then, instead of having data type and encoding both in the
> Tag property, how about defining another Node property,
> "Node Encoding" or something.
> 
> - !!str @utf8a "a"

Since this is incompatible I don't see any improvement over reusing '!' 
for this.

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.