[#8815] Segfault in libc strlen, via rb_str_new2 — "Sean E. Russell" <ser@...>

Howdy,

12 messages 2006/09/09
[#8817] Re: Segfault in libc strlen, via rb_str_new2 — Eric Hodel <drbrain@...7.net> 2006/09/09

On Sep 8, 2006, at 10:10 PM, Sean E. Russell wrote:

Re: Behavior change for Hash#default in 1.8.5?

From: "Wilson Bilkovich" <wilsonb@...>
Date: 2006-09-25 04:04:01 UTC
List: ruby-core #8915
On 9/24/06, Daniel Berger <djberg96@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> It appears that something has changed with Hash#default between 1.8.4
> and 1.8.5:

It looks like this unexpected fun in 1.8.4 was pointed out:
irb(main):001:0> hash = Hash.new {|h,k| h[k] = []}
=> {}
irb(main):002:0> p hash
{}
=> nil
irb(main):003:0> p hash.default
[]
=> nil
irb(main):004:0> p hash
{nil=>[]}
=> nil
irb(main):005:0>

matz says "Let's not have Hash#default evaluate Procs", which removes
this oddity.

It looks like the actual behavior hasn't changed.. but the semantics
of the 'default' method are different now.

In This Thread