[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

:s.respond_to?(:dup) && :s.dup raises

Francois Beausoleil

4/5/2007 5:41:00 PM

Hi all !Symbol lies about it's ability to respond_to? to #dup:irb(main):001:0> :s.respond_to?(:dup)=> trueirb(main):002:0> :s.dupTypeError: can't dup Symbol from (irb):2:in `dup' from (irb):2Fixnum does the same thing. You might argue that the object *can*respond to :dup, except it's simply illegal to respond to it.Anyway, my feeling is that Symbol and Fixnum (probably Numeric) shouldnot respond_to?(:dup).Thanks !-- François Beausoleilhttp://blog.teksol.info/http://piston.ruby...
1 Answer

Tim Hunter

4/5/2007 5:56:00 PM

0

François Beausoleil wrote:
> Anyway, my feeling is that Symbol and Fixnum (probably Numeric) should
> not respond_to?(:dup).

Here's a 76-post thread on this very subject, from about six, seven
weeks ago.

http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/239426?239...

--
Posted via http://www.ruby-....