From: Tim Bates Date: 2003-01-28T22:52:02+09:00 Subject: initialize() and C extensions I'm having a problem with extending TCPSocket, and after some discussion on #ruby-lang it seems that the problem is due to 1.6.8's incorrect handling of C extensions and initialize(). The problem is demonstrated in this piece of code on 1.6.8, but not on 1.7 tim@zaphod:~$ cat b.rb require 'socket' class MySocket < TCPSocket def initialize(address, port, myarg) end end m = MySocket.new('localhost', 9999, 'foo') tim@zaphod:~$ ruby b.rb b.rb:7:in `new': wrong # of arguments(3 for 2) (ArgumentError) from b.rb:7 tim@zaphod:~$ It seems that an initialize() defined in a C extension takes precedence over a subclassed one. This code works fine if you take out the '< TCPSocket' or replace it by (say) Array. Tim Bates -- tim@bates.id.au