Project

General

Profile

Actions

Bug #2253

closed

should Class.new(Class) raise TypeError?

Added by shugo (Shugo Maeda) over 14 years ago. Updated about 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-10-12 trunk 25313) [i686-linux]
Backport:
[ruby-core:26225]

Description

=begin
Class.new(Class) does not raise TypeError as reported in [ruby-dev:34114].

$ ruby-1_8 -ve 'Class.new(Class)'
ruby 1.8.8dev (2009-10-22 revision 25430) [i686-linux]
$ ruby-1_8 -ve 'class Foo < Class; end'
ruby 1.8.8dev (2009-10-22 revision 25430) [i686-linux]
-e:1: can't make subclass of Class (TypeError)

$ ruby-trunk -ve 'Class.new(Class)'
ruby 1.9.2dev (2009-10-12 trunk 25313) [i686-linux]
$ ruby-trunk -ve 'class Foo < Class; end'
ruby 1.9.2dev (2009-10-12 trunk 25313) [i686-linux]
-e:1:in `': can't make subclass of Class (TypeError)

JRuby also works same as MRI. awesome.

should it raise TypeError?

FYI, in [ruby-list:8341], Matz said that he tried to
allow subclassing of Class but he couldn't do it for
implementation reason.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0