[#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: Literal inconsistency

From: Calamitas <calamitates@...>
Date: 2006-09-04 15:44:10 UTC
List: ruby-core #8792
On 9/4/06, URABE Shyouhei <shyouhei@ice.uec.ac.jp> wrote:
> Hi,
>
> Calamitas wrote:
> > Well, immutable is relative:
>
> The term "immutable" is not clearly defined in Ruby.  You may surprise
> to know that even nil can be modified.
>
> a = nil
> def a.foo
>   p self
> end
> a.foo # => nil
>
>
> Matz once wrote to me there are no "strictly" immutable objects.

I know, I've tried lots of these things when I was learning Ruby, like
adding instance variables to Fixnums:

  irb(main):001:0> 1.instance_eval { @a = 1 }
  => 1
  irb(main):002:0> puts 1.instance_eval { @a }
  1
  => nil

But whatever the reason for the optimization, it unexpectedly broke
some code of mine. Sometimes I wonder if it might be interesting to
have a list of optimizations in Ruby that are (usually unexpectedly)
visible to the programmer and that programmers may want to beware of.

Peter

In This Thread