Re: Types, byte codes etc.

"Brad Baxter" <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On 5/7/07, Oren Ben-Kiki <[email protected]> wrote:
>
> On Mon, 2007-05-07 at 11:22 -0400, Brad Baxter wrote:
>
> > Small question: In this canonical format, how do you expect to treat
> > newlines that are in values, e.g.,
> >
> > [
> > "Romeo
> > Juliet"
> > ]
> >
> > or
> >
> > [
> > "Romeo\nJuliet"
> > ]
>
> The latter, for two reasons. First, I _think_ the 1st format is not
> valid in ECMA and JSON. Second, the second format does not raise sticky
> issues with regard to line break normalization.


Hi all,

I have another question, which may be better described as a point of
discussion.  I'm intrigued by this idea of the canonical format that
is essentially JSON with some YAML extras.  One aspect of
JSON (and btw of Perl's Data::Dumper format) is that a given object
may be represented on a single line, i.e., all newlines in the format
are represented by "\n".

So my question/point-of-discussion is: Could the newlines separating
tokens in the canonical structure be replaced with spaces and still
allow a YAML parser to correctly parse the structure?  Currently,
the answer is no for at least three reasons:

comments: # comment
directives: %YAML 1.2, %TAG !o! tag:ben-kiki.org,2000:
end of document markers: ...

There may be others, but these are the ones I found that seem to
rely on a newline to end them.

To answer yes to my question, I guess an extra form for
these could be introduced, for at least the canonical format.
I suppose the end of document marker--since it contains no
spaces--could be modified to recognize a following space as well
as a following newline.  The directives could perhaps accept a
quoted or parenthesized parameter list.  And perhaps a #' sort of
construct could say, "a comment follows that is delimited by a
single quote", e.g.

#' 'the ties that bind'

I'm not suggesting that these are the best options, just possible
examples.

One response is obviously, "Does anybody really need this?"

I don't know about "need", but I for one would not mind being able
to store serialized objects in a flat file, one object per line.  I can
do this with JSON (though they are simply scalars, sequences and
mappings--not true objects--and with Data::Dumper, including true
objects.   Of course, these do not have comments and directives
like YAML.

I guess the bottom line is simply this: Why not allow a YAML
stream, in its canonical form, to fit on a singe line? If it's not too
expensive--either technically or for readability--then one would at
least know that the option is there.

Again, I'm not expressing a need necessarily, but I have been
exploring flat file storage options. I think since a canonical format
is being formulated, this might be a good point to have this discussion.

Cheers,

-- Brad

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
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.