[#2367] Standard libraries — Dave Thomas <dave@...>

From ruby-dev summary:

60 messages 2004/02/11

[#2397] PATCH: deprecate cgi-lib, getopts, importenv, parsearg from standard library — Gavin Sinclair <gsinclair@...>

Index: cgi-lib.rb

15 messages 2004/02/12

[#2465] PATCH: OpenStruct#initialize to yield self — Gavin Sinclair <gsinclair@...>

This is a common approach I use to object initialization; I don't know

24 messages 2004/02/19

Re: Change to #new (was OpenStruct#initialize to yield self)

From: Austin Ziegler <austin@...>
Date: 2004-02-20 05:59:53 UTC
List: ruby-core #2475
On Fri, 20 Feb 2004 11:28:58 +0900, Dave Thomas wrote:
> On Feb 19, 2004, at 18:37, Austin Ziegler wrote:
>> Ugh. I'm not sure that I like that.
> I'm not sure you'd notice any difference. If your constructors used a
> block, then they'd already have code to deal with it. If they didn't,
> then there'd be no change in behavior.

class Bar < Foo
  def initialize(*args, &blk)
    super
    instance_eval(blk)
  end
end

Would the presence of &blk immediately make super pretend to be super {}?

I have code that does the "yield self" and follows your original suggestion 
of instance_eval for private methods.

-austin
--
austin ziegler    * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2004.02.20
                                         * 00.57.09




In This Thread