[#927] UnboundMethod#to_proc — Dave Thomas <dave@...>

I'm wondering what I can do with a Proc generated by

17 messages 2003/04/06

Possible inconsistency in IO

From: matz@... (Yukihiro Matsumoto)
Date: 2003-04-01 23:54:16 UTC
List: ruby-core #924
Hi,

Somehow, Dave Thomas used his unregistered address, which rejected by
the list server.

In message "NOT MEMBER article from dave@pragprog.com (ruby-core ML)"
    on 03/04/02, ruby-core-admin@ruby-lang.org <ruby-core-admin@ruby-lang.org> writes:

|NOT MEMBER article from dave@pragprog.com
|
|
|Original mail as follows:
|
|   Date: Tue, 1 Apr 2003 15:25:43 -0600
|   Subject: Possible inconsistency in IO
|   From: Dave Thomas <dave@pragprog.com>
|   To: ruby-core@ruby-lang.org
|   
|   This is pretty trivial, but IO.new warns if it is passed a block, but 
|   IO.for_fd doesn't (but it does ignore the block).
|   
|   Two questions:
|   
|   1. Is this correct?

Yes.  It is too easy to confuse IO.open and IO.new, so that I decided
to warn it.  In fact, I myself confused to make IO.new to take a block
for a while.

|   2. Is there any other external difference between the two methods?

No, they are identical except for this warning.  But your question
made me realize that I need to reject File.for_fd(path), but
File.new(path).  I will fix this soon.

Summary:

(a) IO.new warns because *I* made mistake.  This warning should be
    removed in the future.

(b) IO.for_fd should only take a file descriptor number, even for IO's
    subclasses, e.g. File.for_fd().


							matz.

In This Thread

Prev Next