Issue #11929 has been updated by D.E. Akers.


[This demonstration](https://eval.in/495653) should clarify the observed behavior. `Symbol`, `Fixnum`, and indeed every other numeric class inherit their `#dup` from `Kernel`, whose implementation does a sanity check before proceeding, thus obviating the need to remove the method from the classes for which it might otherwise make sense to do so.

----------------------------------------
Bug #11929: dup should be undefined in Fixnum
https://bugs.ruby-lang.org/issues/11929#change-55882

* Author: xavier nayrac
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-12-06 trunk 52904) [i686-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
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?




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>