Final/closed classes in Ruby (was: Sharp knives and glue)

From: Gregory Seidman [mailto:gsslist+ruby@anthropohedron.net]
Sent: Thursday, May 11, 2006 3:39 PM
To: ruby-talk ML
Subject: Re: final/closed classes in Ruby (was: Sharp knives and glue)

<snip>

class Foo
  def test
    puts "hello"
  end
  freeze #this already exists and does what you want
end

Well, I'll be damned. I didn't know you could do that. You learn
something knew every day I guess. :slight_smile:

Doesn't prevent subclassing though. :slight_smile:

Thanks,

Dan

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

···

-----Original Message-----

But any solution you can put into place with pure ruby, can be circumvented
just as easily. :slight_smile:

···

On 5/11/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

> -----Original Message-----
> From: Gregory Seidman [mailto:gsslist+ruby@anthropohedron.net]
> Sent: Thursday, May 11, 2006 3:39 PM
> To: ruby-talk ML
> Subject: Re: final/closed classes in Ruby (was: Sharp knives and glue)

<snip>

> class Foo
> def test
> puts "hello"
> end
> freeze #this already exists and does what you want
> end

Well, I'll be damned. I didn't know you could do that. You learn
something knew every day I guess. :slight_smile:

Doesn't prevent subclassing though. :slight_smile:

Thanks,

Dan

--
===Tanner Burson===
tanner.burson@gmail.com
http://tannerburson.com <---Might even work one day...