in reply to Re: OO in Perl 5: still inadequate
in thread OO in Perl 5: still inadequate

Ruby, like Perl, still allows you to redefine your classes at runtime: that alone was enough to ruin the language for me. At least perl warns you when you redefine a function; I got no such warnings from Ruby.

Erm, did you have warnings enbled?

gamera:~ 835> cat boink.rb class Foo def bar( ) puts "bar" end end class Foo def bar( ) puts "baz" end end gamera:~ 836> ruby -w boink.rb boink.rb:8: warning: method redefined; discarding old bar

Replies are listed 'Best First'.
Re^3: OO in Perl 5: still inadequate
by Anonymous Monk on Jan 23, 2006 at 20:04 UTC
    Apparently not; I was using a tutorial that was redefining classes as it went.

    Apologies to Ruby for the undeserved criticism. But is there some way to freeze the class definition so it can't be changed at all?

    I dislike giving other people plenty of rope to hang me with.

      Yup.

      ---------------------------------------------------------- Module#free +ze mod.freeze ---------------------------------------------------------------------- +-- Prevents further modifications to _mod_.

      And there's also Object#freeze which prevents modification of individual instances (preventing you from adding singleton methods to them).