From: "Haase, Konstantin" Date: 2011-11-09T04:25:51+09:00 Subject: [ruby-core:40857] Re: [ruby-trunk - Feature #5578] Embedded YAML for Ruby 2.0 On Nov 8, 2011, at 15:29 , Thomas Sawyer wrote: > > Issue #5578 has been updated by Thomas Sawyer. > > > @kurt "Why does YAML need first class status?" > > On the surface it's just more elegant. e.g. > > x = --- > a: 1 > b: 2 > ... It's just another syntax for a Hash then if you parse it right away, no? Konstantin > > vs. > > x = YAML %{ > a: 1 > b: 2 > } > > But see my last post about the potential for deeper integration. In short, the later can only ever handle a string. Integrating YAML more deeply could allow for Ruby objects to be inserted directly into the YAML structure. > > --- > time: ->{ Time.now } > ... > > Would be equivalent too > > { > 'time' => Time.now > } > > Why would you want to do that? For the very reasons we like YAML. It is an easy to read and concise format, especially when the data structure gets a little bit more nested than just a couple of elements (unlike the examples above). > > Note also that JSON is a subset of YAML. So if Ruby supported YAML natively, it would also support JSON natively --just like Javascript. > > ---------------------------------------- > Feature #5578: Embedded YAML for Ruby 2.0 > http://redmine.ruby-lang.org/issues/5578 > > Author: Thomas Sawyer > Status: Open > Priority: Normal > Assignee: > Category: > Target version: 2.0.0 > > > Way cool would be support for embedded YAML. > > data = --- > a: 1 > b: 2 > c: 3 > ... > > > > > -- > http://redmine.ruby-lang.org >