Forum: Ruby-core [ruby-trunk - Bug #7027][Open] Tempfile#inspect is Confusing

Posted by Glass_saga (Masaki Matsushita) (Guest)
on 2012-09-15 17:18
(Received via mailing list)
Issue #7027 has been reported by Glass_saga (Masaki Matsushita).

----------------------------------------
Bug #7027: Tempfile#inspect is Confusing
https://bugs.ruby-lang.org/issues/7027

Author: Glass_saga (Masaki Matsushita)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
ruby -v: ruby 2.0.0dev (2012-09-15 trunk 36975) [x86_64-linux]


I think Tempfile#inspect is really confusing.
It says Tempfile object is a File, but it is not a File object.

% irb -r tempfile
irb(main):001:0> t = Tempfile.new("hoge")
=> #<File:/tmp/hoge20120916-12354-uontdm>
irb(main):002:0> t.is_a? File
=> false
irb(main):003:0>

see also (Japanese): 
http://r7kamura.hatenablog.com/entry/2012/09/05/194630
Posted by Hans Mackowiak (hanmac)
on 2012-09-19 17:51
(Received via mailing list)
Issue #7027 has been updated by Hanmac (Hans Mackowiak).


in my opinion Delegator should be improved
so it shows that its a Tempfile, but is_a? should also show that its a 
File or IO
----------------------------------------
Bug #7027: Tempfile#inspect is Confusing
https://bugs.ruby-lang.org/issues/7027#change-29540

Author: Glass_saga (Masaki Matsushita)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
ruby -v: ruby 2.0.0dev (2012-09-15 trunk 36975) [x86_64-linux]


I think Tempfile#inspect is really confusing.
It says Tempfile object is a File, but it is not a File object.

% irb -r tempfile
irb(main):001:0> t = Tempfile.new("hoge")
=> #<File:/tmp/hoge20120916-12354-uontdm>
irb(main):002:0> t.is_a? File
=> false
irb(main):003:0>

see also (Japanese): 
http://r7kamura.hatenablog.com/entry/2012/09/05/194630
Posted by Charles Nutter (headius)
on 2012-09-20 03:33
(Received via mailing list)
Issue #7027 has been updated by headius (Charles Nutter).


In my opinion, Tempfile should not use Delegator at all.

In JRuby, Tempfile actually is a File.

irb(main):001:0> require 'tempfile'
=> true
irb(main):002:0> t = Tempfile.new('blah')
=> 
#<Tempfile:/var/folders/9j/yc18czps1x7cbsz76ccl__740000gn/T/blah.77744.52665>
irb(main):003:0> t.class
=> Tempfile
irb(main):004:0> t.class.superclass
=> File
irb(main):005:0> t.is_a? File
=> true
irb(main):006:0> Tempfile.ancestors
=> [Tempfile, File, IO, File::Constants, Enumerable, Object, Kernel, 
BasicObject]
----------------------------------------
Bug #7027: Tempfile#inspect is Confusing
https://bugs.ruby-lang.org/issues/7027#change-29562

Author: Glass_saga (Masaki Matsushita)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
ruby -v: ruby 2.0.0dev (2012-09-15 trunk 36975) [x86_64-linux]


I think Tempfile#inspect is really confusing.
It says Tempfile object is a File, but it is not a File object.

% irb -r tempfile
irb(main):001:0> t = Tempfile.new("hoge")
=> #<File:/tmp/hoge20120916-12354-uontdm>
irb(main):002:0> t.is_a? File
=> false
irb(main):003:0>

see also (Japanese): 
http://r7kamura.hatenablog.com/entry/2012/09/05/194630
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-05 12:03
(Received via mailing list)
Issue #7027 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to Glass_saga (Masaki Matsushita)
Target version set to 2.0.0

Glass_saga,

Sounds good.  Please commit it.
If something comes up, we can deal with it then.

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #7027: Tempfile#inspect is Confusing
https://bugs.ruby-lang.org/issues/7027#change-32389

Author: Glass_saga (Masaki Matsushita)
Status: Assigned
Priority: Normal
Assignee: Glass_saga (Masaki Matsushita)
Category: lib
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-15 trunk 36975) [x86_64-linux]


I think Tempfile#inspect is really confusing.
It says Tempfile object is a File, but it is not a File object.

% irb -r tempfile
irb(main):001:0> t = Tempfile.new("hoge")
=> #<File:/tmp/hoge20120916-12354-uontdm>
irb(main):002:0> t.is_a? File
=> false
irb(main):003:0>

see also (Japanese): 
http://r7kamura.hatenablog.com/entry/2012/09/05/194630
Posted by Glass_saga (Masaki Matsushita) (Guest)
on 2012-11-06 10:48
(Received via mailing list)
Issue #7027 has been updated by Glass_saga (Masaki Matsushita).

Status changed from Assigned to Closed

I have commited in r37492.
----------------------------------------
Bug #7027: Tempfile#inspect is Confusing
https://bugs.ruby-lang.org/issues/7027#change-32480

Author: Glass_saga (Masaki Matsushita)
Status: Closed
Priority: Normal
Assignee: Glass_saga (Masaki Matsushita)
Category: lib
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-15 trunk 36975) [x86_64-linux]


I think Tempfile#inspect is really confusing.
It says Tempfile object is a File, but it is not a File object.

% irb -r tempfile
irb(main):001:0> t = Tempfile.new("hoge")
=> #<File:/tmp/hoge20120916-12354-uontdm>
irb(main):002:0> t.is_a? File
=> false
irb(main):003:0>

see also (Japanese): 
http://r7kamura.hatenablog.com/entry/2012/09/05/194630
Posted by nagachika (Tomoyuki Chikanaga) (Guest)
on 2012-11-06 15:49
(Received via mailing list)
Issue #7027 has been updated by nagachika (Tomoyuki Chikanaga).


+ r37493 (for ChangeLog ML, ticket ref.)
----------------------------------------
Bug #7027: Tempfile#inspect is Confusing
https://bugs.ruby-lang.org/issues/7027#change-32500

Author: Glass_saga (Masaki Matsushita)
Status: Closed
Priority: Normal
Assignee: Glass_saga (Masaki Matsushita)
Category: lib
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-15 trunk 36975) [x86_64-linux]


I think Tempfile#inspect is really confusing.
It says Tempfile object is a File, but it is not a File object.

% irb -r tempfile
irb(main):001:0> t = Tempfile.new("hoge")
=> #<File:/tmp/hoge20120916-12354-uontdm>
irb(main):002:0> t.is_a? File
=> false
irb(main):003:0>

see also (Japanese): 
http://r7kamura.hatenablog.com/entry/2012/09/05/194630
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.