[#39052] Fwd: [redmine4ruby-lang:253] [Bug #1914] ruby-1.9.1-p243 failed to build from source on aix 5.3 with gcc 4.2.0 — Yugui <yugui@...>

Redmine管理用プロジェクトに報告されてしまったので転送します。

12 messages 2009/08/09
[#39264] Re: Fwd: [redmine4ruby-lang:253] [Bug #1914] ruby-1.9.1-p243 failed to build from source on aix 5.3 with gcc 4.2.0 — Yutaka Kanemoto <kinpoco@...> 2009/09/08

金本と申します。

[#39107] [Bug #1952] cannot stop with Ctrl+C — Usaku NAKAMURA <redmine@...>

Bug #1952: cannot stop with Ctrl+C

14 messages 2009/08/18

[#39167] [Bug #2000] Change the license to "GPLv2+ or Ruby's original". — Mamoru Tasaka <redmine@...>

Bug #2000: Change the license to "GPLv2+ or Ruby's original".

11 messages 2009/08/26

[#39193] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Tanaka Akira <akr@...>

In article <200908281827.n7SIRbaX003476@ci.ruby-lang.org>,

16 messages 2009/08/29
[#39194] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Nobuyoshi Nakada <nobu@...> 2009/08/29

なかだです。

[#39195] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Tanaka Akira <akr@...> 2009/08/29

In article <4a988633.9553f10a.4496.483e@mx.google.com>,

[#39196] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Nobuyoshi Nakada <nobu@...> 2009/08/29

なかだです。

[#39197] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Tanaka Akira <akr@...> 2009/08/29

In article <4a989f76.1602be0a.3de4.1131@mx.google.com>,

[#39198] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Yukihiro Matsumoto <matz@...> 2009/08/29

まつもと ゆきひろです

[#39206] Re: [ruby-cvs:31917] Ruby:r24699 (trunk): * lib/tmpdir.rb (Dir.mktmpdir): removed thread race condition. — Nobuyoshi Nakada <nobu@...> 2009/08/31

なかだです。

[ruby-dev:39046] Re: [BUG] Re: [ruby-cvs:31600] Ruby:r24382 (trunk): * hash.c (rb_hash_replace): should copy compare_by_identity status as well.

From: Yukihiro Matsumoto <matz@...>
Date: 2009-08-08 14:13:35 UTC
List: ruby-dev #39046
まつもと ゆきひろです

In message "Re: [ruby-dev:39045] [BUG] Re: [ruby-cvs:31600] Ruby:r24382 (trunk): * hash.c (rb_hash_replace): should copy compare_by_identity status as well."
    on Sat, 8 Aug 2009 22:03:00 +0900, "Yugui (Yuki Sonoda)" <yugui@yugui.jp> writes:

|元の[ruby-core:24728]の、dup, cloneでcompare_by_identityがコピーされない
|という問題はこれで直りました。
|
|ただ、これですとHash#replaceした場合までコピーされてしまいますよね?
|Hash#replaceは
|> Replaces the contents of <i>hsh</i> with
|と書いてあるくらいなので、内容のみを移してcompare_by_identity'nessは移ら
|ないという解釈もあり得ると思います。
|
|どちらも不幸になるケースがあると思いますが、どちらの挙動が望ましいでしょ
|うか。

あまり発生しないと思うので、心配してもしかたがないような気も
しないでもないのですが、仕様としては定義する必要があるでしょ
うね。

で、私の考えを言えば、Hashのキーは比較の状態との組み合わせで
ないと意味がないように思います。たとえば、

  h = {}
  h.compare_by_identity
  h["foo"] = "bar"
  h["foo"] = "baz"
  p h  # => {"foo"=>"bar", "foo"=>"baz"}

となるわけですが、仮にreplaceがcompare_by_identity状態をコピー
しないとすると

  h2 = {}
  h2.replace(h)
  p h2["foo"]    # => "bar"? "baz"? 予測困難

となるわけです。これはあんまりうれしくありません(1.9だから挿
入順が早い方が優先なんですが、いつも挿入順が明らかとは限りま
せんし)。一方、コピーするならば

  p h2 # => {"foo"=>"bar", "foo"=>"baz"}

となるでしょう。h2["foo"]の結果は当然nilです。

というわけで、現状通りcompare_by_identity性はreplaceによって
コピーされた方がよい、に一票です。

                                まつもと ゆきひろ /:|)

In This Thread

Prev Next