Project

General

Profile

Actions

Bug #11929

closed

No programatic way to check ability to dup/clone an object

Added by lkdjiin (xavier nayrac) over 8 years ago. Updated over 7 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-12-06 trunk 52904) [i686-linux]
[ruby-core:72621]

Description

We can't dup a Fixnum, and it's ok. But I'm wondering «why is Fixnum saying it can dup?»

1.respond_to?(:dup) #=> true

Don't you think that the dup method should be undefined in the class Fixnum?

Currently I can do class Fixnum; undef :dup; end, but that should be in the core Ruby, isn't it?


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #12979: Avoid exception for #dup on Integer (and similar cases)Closednobu (Nobuyoshi Nakada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0