[#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: nobu.nokada@...
Date: 2004-02-20 03:33:01 UTC
List: ruby-core #2473
Hi,

At Fri, 20 Feb 2004 02:42:00 +0900,
Dave Thomas wrote in [ruby-core:02468]:
> As more general suggestion. Could 'new' yield the new object is a block 
> is given? This behavior could then be overridden by the classes where 
> this isn't appropriate (such as hash).

It's an old fashion.

  $ ruby-1.6 -ve 'p File.new("version.h"){|f|p f.read}'
  ruby 1.6.8 (2003-10-15) [i686-linux]
  -e:1: warning: File::new() does not take block; use File::open() instead
  #<File:0x402b6978>

  $ ruby-1.4 -ve 'p File.new("version.h"){|f|p f.read}'
  ruby 1.4.6 (2000-08-16) [i686-linux]
  "#define RUBY_VERSION \"1.9.0\"\n#define RUBY_RELEASE_DATE \"2004-02-19\"\n#..."
  nil

-- 
Nobu Nakada

In This Thread