Where to find a description of yaml for ruby?

R

Ryan Davis

You know, I'm beginning to hate YAML. It loooked deceivingly simple at
first. But it turns out it's quite complicated. XML is quite simple by
comparison.

you, sir, are UNSANE
 
P

Phillip Gawlowski

You know, I'm beginning to hate YAML. It loooked deceivingly simple at
first. But it turns out it's quite complicated. XML is quite simple by
comparison.

See that guy in the corner? Twitching and twisting? He wrote an ANT
makefile once. ;)

But one thing is annoying with YAML: Significant whitespace. \t or a
proper space have different meanings, as does the amount of space.

Ain't it grant that
require "yaml"
var = Object.to_yaml # or dump, if you want to write a file
another_var = YAML.load var

makes it so very easy to use? And it can be read (not necessarily
written) by humans, too.

Try reading and writing XML in just one three lines! ;)
 
M

Marnen Laibow-Koser

Phillip said:
See that guy in the corner? Twitching and twisting? He wrote an ANT
makefile once. ;)

But one thing is annoying with YAML: Significant whitespace. \t or a
proper space have different meanings, as does the amount of space.

Tabs are not allowed in Yaml files, precisely in order to cut down
confusion.

The significant indentation is very clear and straightforward. I
actually think it works well in context.
Ain't it grant that
require "yaml"
var = Object.to_yaml # or dump, if you want to write a file
another_var = YAML.load var

makes it so very easy to use? And it can be read (not necessarily
written) by humans, too.

I find Yaml easy to write...I'd rather write it than XML any day.
Try reading and writing XML in just one three lines! ;)

There's no comparable XML library?

Best,
 
M

Marnen Laibow-Koser

Albert said:
You know, I'm beginning to hate YAML. It loooked deceivingly simple at
first. But it turns out it's quite complicated. XML is quite simple by
comparison.

Are you kidding? Why do you say this?

Best,
 
F

Fritz Trapper

Phillip said:
But one thing is annoying with YAML: Significant whitespace. \t or a
proper space have different meanings, as does the amount of space.

Thats really a bad issue. After reading docs on YAML, I decided to use
it for plane data only, no structs or trees, as I wanted to.
Ain't it grant that
require "yaml"
var = Object.to_yaml # or dump, if you want to write a file
another_var = YAML.load var

makes it so very easy to use? And it can be read (not necessarily
written) by humans, too.

Yes, that's very elegant and useful für simple configuration files.
Try reading and writing XML in just one three lines! ;)

Reading complex data structures expressed in well formated XML is
possible. Reading the same in YAML is at least quite difficult.
 
P

Phillip Gawlowski

Thats really a bad issue. After reading docs on YAML, I decided to use
it for plane data only, no structs or trees, as I wanted to.

You probably meant "plain data"?

Stupid false friends...

Anyway: Yeah, significant whitespace is an issue. It's what keeps me
looking at Python off and on (that, and the performance experience of
two of the three Python apps I use is less than stellar).
Yes, that's very elegant and useful für simple configuration files.

Or simple data structures, like Hashes and Arrays, or Rails' test mock ups.
Reading complex data structures expressed in well formated XML is
possible. Reading the same in YAML is at least quite difficult.

Well, I meant "reading and writing programmatically" :)
 
P

pharrington

Thats really a bad issue. After reading docs on YAML, I decided to use
it for plane data only, no structs or trees, as I wanted to.



Yes, that's very elegant and useful für simple configuration files.


Reading complex data structures expressed in well formated XML is
possible. Reading the same in YAML is at least quite difficult.

Let me ask you: do you also consider JSON to be more complicated than
XML? Indeed, representing a complex entity would be hellish with mere
hashes, arrays, and scalars. But think about the use case: it is not
intended to be able to represent anything and everything.

Similarly with YAML: yes, it is a *fantastic* fit for configuration
files. It is a *fantastic* fit for serializing objects in a
multilingual setting. Can you use it as the basis for your makefile
system? Unlikely... But after a little thought you probably don't want
to use XML for it, either.

This is my (and probably many others') problem with XML: it *can* do
everything, but it's almost always the wrong tool for the job. For a
simple task, use a simple tool. For a complex task, its probably
easier to create a format/system suited to the task (or just think
about the task differently!) than to devise endless pages of XML
specification.
 
M

Marnen Laibow-Koser

Fritz said:
Thats really a bad issue.

Not at all. I've never had a spacing issue in Yaml (except once when I
was using an unfamiliar feature). Have you?
After reading docs on YAML, I decided to use
it for plane data only, no structs or trees, as I wanted to.

Why? I use it for trees and other structures all the time. It's very
easy to read and write. If you don't like the indented syntax, you can
use the JSON-like syntax in places where it makes sense.
Yes, that's very elegant and useful für simple configuration files.

And for just about anything else.
Reading complex data structures expressed in well formated XML is
possible. Reading the same in YAML is at least quite difficult.

I would usually say the opposite. All the endtags in XML make things
harder for me to read, not easier. And the indentation will be the same
in both pretty XML and Yaml, so no difference there.

Got a concrete example?

Best,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top