[#1207] warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...>

This message was posted to ruby-talk, but I didn't get responce from

22 messages 2003/07/01
[#1208] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/01

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1209] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/02

ts wrote:

[#1210] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/02

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1211] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1212] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/04

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1213] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1214] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/04

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1215] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1237] FTP.new with block — Gavin Sinclair <gsinclair@...>

Hi,

22 messages 2003/07/19
[#1238] Re: [Patch] FTP.new with block — ts <decoux@...> 2003/07/19

>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:

[#1240] Re: [Patch] FTP.new with block — Mathieu Bouchard <matju@...> 2003/07/19

[#1297] Fix for Bug 1058 — Markus Walser <walser@...>

Hi,

16 messages 2003/07/25

Re: [Patch] FTP.new with block

From: Gavin Sinclair <gsinclair@...>
Date: 2003-07-19 18:16:02 UTC
List: ruby-core #1246
On Sunday, July 20, 2003, 4:11:32 AM, Dave wrote:

> Yukihiro Matsumoto wrote:


>> But "open" returns the last value evaluated in the block, for
>> convenience, whereas "new", as I believe, should always return a new
>> instance.  For me, this is more important than your reason.

> Perhaps this time you should invoke the principle of least confusion... 
> (although I can see the argument both ways)

> If you allowed passing a block to .new, then it would be meaningless to 
> return a file object, so your choices would be either nil or the block 
> value. If you made it the block value, then folks wouldn't have to 
> remember the difference between open and new.

> There are many other methods whose return value varies if a block is 
> given, so there are precedents.


My suggestion is:
  - disallow block for File.new (i.e. no change)
  - enforce block for File.open (because open implies close)

X.new should always return "instance of X".  There's no need to force
File.new and File.open to mean the same thing.

I realise the "open implies close" logic is pretty dodgy, but it's
such a nifty language feature.

Gavin


In This Thread