Where to find a description of yaml for ruby?

Discussion in 'Ruby' started by Fritz Trapper, Dec 30, 2009.

  1. Fritz Trapper, Dec 30, 2009
    #1
    1. Advertising

  2. Fritz Trapper, Dec 30, 2009
    #2
    1. Advertising

  3. Phillip Gawlowski, Dec 30, 2009
    #3
  4. Phillip Gawlowski wrote:
    > On 30.12.2009 20:40, Fritz Trapper wrote:
    >> Where to find a description of yaml for ruby?

    >
    >
    > First hit on a Google search: http://www.yaml.org/
    >
    > A bit down: http://en.wikipedia.org/wiki/YAML


    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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Albert Schlef, Dec 31, 2009
    #4
  5. Fritz Trapper

    Ryan Davis Guest

    On Dec 30, 2009, at 21:45 , Albert Schlef wrote:

    > 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
     
    Ryan Davis, Dec 31, 2009
    #5
  6. On 31.12.2009 06:45, Albert Schlef wrote:

    > 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! ;)

    --
    Phillip Gawlowski
     
    Phillip Gawlowski, Dec 31, 2009
    #6
  7. Phillip Gawlowski wrote:
    > On 31.12.2009 06:45, Albert Schlef wrote:
    >
    >> 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.


    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,
    --
    Marnen Laibow-Koser
    http://www.marnen.org

    --
    Posted via http://www.ruby-forum.com/.
     
    Marnen Laibow-Koser, Dec 31, 2009
    #7
  8. Albert Schlef wrote:
    > Phillip Gawlowski wrote:
    >> On 30.12.2009 20:40, Fritz Trapper wrote:
    >>> Where to find a description of yaml for ruby?

    >>
    >>
    >> First hit on a Google search: http://www.yaml.org/
    >>
    >> A bit down: http://en.wikipedia.org/wiki/YAML

    >
    > 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,
    --
    Marnen Laibow-Koser
    http://www.marnen.org

    --
    Posted via http://www.ruby-forum.com/.
     
    Marnen Laibow-Koser, Dec 31, 2009
    #8
  9. Phillip Gawlowski wrote:
    > 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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Fritz Trapper, Dec 31, 2009
    #9
  10. On 31.12.2009 13:27, Fritz Trapper wrote:
    > Phillip Gawlowski wrote:
    >> 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.


    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).

    >> 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.


    Or simple data structures, like Hashes and Arrays, or Rails' test mock ups.

    >> 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.


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

    --
    Phillip Gawlowski
     
    Phillip Gawlowski, Dec 31, 2009
    #10
  11. Fritz Trapper

    pharrington Guest

    On Dec 31, 7:27 am, Fritz Trapper <> wrote:
    > Phillip Gawlowski wrote:
    > > 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.
    > --
    > Posted viahttp://www.ruby-forum.com/.


    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.
     
    pharrington, Dec 31, 2009
    #11
  12. Fritz Trapper wrote:
    > Phillip Gawlowski wrote:
    >> 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.


    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.

    >
    >> 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.


    And for just about anything else.

    >
    >> 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.


    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,
    --
    Marnen Laibow-Koser
    http://www.marnen.org

    --
    Posted via http://www.ruby-forum.com/.
     
    Marnen Laibow-Koser, Dec 31, 2009
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RubyQuestions
    Replies:
    0
    Views:
    241
    RubyQuestions
    Dec 3, 2003
  2. Paul Battley

    YAML.dump/YAML.load bug

    Paul Battley, Aug 3, 2005, in forum: Ruby
    Replies:
    0
    Views:
    200
    Paul Battley
    Aug 3, 2005
  3. Eric Promislow
    Replies:
    4
    Views:
    225
    Eric Promislow
    Oct 31, 2006
  4. Joshua Choi

    yaml.rb and YAML "%" directives

    Joshua Choi, Jan 14, 2007, in forum: Ruby
    Replies:
    1
    Views:
    191
  5. Fransiscus Xaverius

    YAML Problem YAML::Object

    Fransiscus Xaverius, Dec 14, 2007, in forum: Ruby
    Replies:
    2
    Views:
    167
    Fransiscus Xaverius
    Dec 14, 2007
Loading...

Share This Page