Group: comp.lang.ruby
From: "Rule.rule"
Date: Sunday, February 17, 2008 4:57 PM
Subject: Re: Ruby type-safe? Ruby strongly/weakly typed? Ruby pitfalls?

On Feb 6, 7:56 am, Eivind Eklund wrote:
> On Feb 6, 2008 2:20 AM,rule.rule.r...@gmail.com
>
> wrote:
> > Hi,
>
> > I added some paragraphs to theRubyarticle on Wikipedia:
>
> > Type system
> > - IsRubytype-safe?
> > - IsRubystrongly typed?
>
> Def 8 seems to be wrong; you're looking at what a variable refers to,
> rather than the object type. The object type is constant throughout
> object lifetime inRuby(excepting some hacks that I think are
> C-based).
>
> Eivind.

OK, I see what you mean...
So this might then be a better example of the type of an object
changing at runtime in Ruby...


x = 4

class Fixnum
def twice
to_i * 2
end
end

puts x.twice

Safety Articles | Usenet Groups | Usenet News | Bluegrass