[#22684] [Bug #1247] YAML::load converts some dates into strings — Matthew Wilson <redmine@...>

Bug #1247: YAML::load converts some dates into strings

10 messages 2009/03/05

[#22725] [Bug #1253] Fix MSVC Build Issues — Charlie Savage <redmine@...>

Bug #1253: Fix MSVC Build Issues

13 messages 2009/03/07

[#22727] Moving ruby 1.9.1 forward on windows — Charlie Savage <cfis@...>

Hi everyone,

14 messages 2009/03/08

[#22731] [Bug #1255] += for large strings egrigiously slow — James Lee <redmine@...>

Bug #1255: += for large strings egrigiously slow

11 messages 2009/03/08

[#22736] Ruby 1.9.1 and tail recursion optimization — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Moin, moin!

13 messages 2009/03/08
[#22739] Re: Ruby 1.9.1 and tail recursion optimization — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...> 2009/03/08

Wolfgang N疆asi-Donner schrieb:

[#22748] [Feature #1256] Add constant TAILRECURSION to let a program recognize if tail recursion optimization is implemented — Wolfgang Nádasi-Donner <redmine@...>

Feature #1256: Add constant TAILRECURSION to let a program recognize if tail recursion optimization is implemented

7 messages 2009/03/08

[#22803] Relegate 1.8.6 to Engine Yard, part II — Urabe Shyouhei <shyouhei@...>

Hello and sorry for my being slow for this issue. It's OK now for me to pass

21 messages 2009/03/10

[#22812] [Bug #1261] cross-compiling Ruby extensions using mkmf doesn't fully respect DESTDIR — Daniel Golle <redmine@...>

Bug #1261: cross-compiling Ruby extensions using mkmf doesn't fully respect DESTDIR

8 messages 2009/03/10

[#22892] Ruby Time — valodzka <valodzka@...>

Got tired of current ruby Time limitation, I have written this -

24 messages 2009/03/14
[#22949] Re: Ruby Time — Tanaka Akira <akr@...> 2009/03/19

In article <9e19ed87-9d12-4f98-af3c-bd49a71b0bd4@p11g2000yqe.googlegroups.com>,

[#22974] Re: Ruby Time — valodzka <valodzka@...> 2009/03/20

[#22977] Re: Ruby Time — Urabe Shyouhei <shyouhei@...> 2009/03/20

valodzka wrote:

[#22981] Re: Ruby Time — valodzka <valodzka@...> 2009/03/21

> I bet you'll get tired of updating that database. There's a major difference

[#22893] [Feature #1291] O_CLOEXEC flag missing for Kernel::open — David Martin <redmine@...>

Feature #1291: O_CLOEXEC flag missing for Kernel::open

10 messages 2009/03/15

[#22939] [Bug #1303] A name considered a local variable on RHS of an assignment that defines it — Tomas Matousek <redmine@...>

Bug #1303: A name considered a local variable on RHS of an assignment that defines it

8 messages 2009/03/19

[#23063] [Bug #1332] Reading file on Windows is 500x slower then with previous Ruby version — Damjan Rems <redmine@...>

Bug #1332: Reading file on Windows is 500x slower then with previous Ruby version

11 messages 2009/03/30

[#23075] [Bug #1336] Change in string representation of Floats — Brian Ford <redmine@...>

Bug #1336: Change in string representation of Floats

37 messages 2009/03/31
[#23179] [Bug #1336] Change in string representation of Floats — Roger Pack <redmine@...> 2009/04/11

Issue #1336 has been updated by Roger Pack.

[#23181] Re: [Bug #1336] Change in string representation of Floats — Brent Roman <brent@...> 2009/04/11

[#23186] Re: [Bug #1336] Change in string representation of Floats — Yukihiro Matsumoto <matz@...> 2009/04/12

Hi,

[#23187] Re: [Bug #1336] Change in string representation of Floats — Brent Roman <brent@...> 2009/04/13

[#23188] Re: [Bug #1336] Change in string representation of Floats — Yukihiro Matsumoto <matz@...> 2009/04/13

Hi,

[ruby-core:22909] Which YAML::Syck types/methods are required by the spec?

From: Shri Borde <Shri.Borde@...>
Date: 2009-03-16 06:47:40 UTC
List: ruby-core #22909
I assume that most of the types under YAML::Syck are supposed to be implementation details, right?

Assuming this is correct, some of those types are actually used by existing Ruby code, mainly with YAML.quick_emit. In the real-world Ruby snippet below, the Ruby code uses YAML::Syck in two ways:

1.       It passes an instance of YAML::Syck::Emitter as an argument to YAML.quick_parse

2.       It calls YAML::Syck::Out#map.

require "yaml"

class B
  def to_yaml emitter
    YAML.quick_emit(object_id, emitter) do |out|
      out.map("tag:ruby.yaml.org,2002:object:B", to_yaml_style) do |map|
        map.add("b_attr", "some value")
      end
    end
  end
end

If you look at the extended version of the code at the end (also at http://gist.github.com/79760# with color coding), you will see the details of the types of the values used in the snippet. Given that existing Ruby code deals with some parts of YAML::Syck, its not clear what is left as an implementation detail, and what is required by the spec.

It seems like YAML::Syck::Emitter and YAML::Syck::Out should both include (new) modules like YAML::BaseEmitter and YAML::BaseOutputter which will have the formal API that all Ruby implementations need to support. The pattern would be the same as YAML::Syck::Map including YAML::BaseNode today. Does this sound right, and if so, should I open a bug to track this issue for Ruby 1.9?

Also, YAML::Syck::Emitter and YAML::Syck::Out have a number of methods. I have not seen any uses of these methods, but I havent really used yaml much either. Does anyone know if any of these other methods are actually used by Ruby code?

Thanks,
Shri


require "yaml"

class A
  def initialize
    @b = B.new
  end
end

class B
  def to_yaml emitter
    puts emitter.class # YAML::Syck::Emitter
    puts emitter.class.ancestors.inspect # [YAML::Syck::Emitter, Object, Kernel]
    puts (emitter.methods - Object.new.methods).sort.inspect # ["emit", "level", "level=", "node_export", "reset", "set_resolver"]

    YAML.quick_emit(object_id, emitter) do |out|
      puts out.class # YAML::Syck::Out
      puts out.class.ancestors.inspect # [YAML::Syck::Out, Object, Kernel]
      puts (out.methods - Object.new.methods).sort.inspect # ["emitter", "emitter=", "map", "scalar", "seq"]

      out.map("tag:ruby.yaml.org,2002:object:B", to_yaml_style) do |map|
        puts map.class # YAML::Syck::Map
        puts map.class.ancestors.inspect # [YAML::Syck::Map, YAML::Syck::Node, YAML::BaseNode, Object, Kernel]
        puts (map.methods - Object.new.methods).sort.inspect # ...

        map.add("b_attr", "some value")
      end
    end
  end
end

a = A.new
a.to_yaml


In This Thread

Prev Next