From: David Landrith Date: 2003-01-01T02:51:31+09:00 Subject: --Apple-Mail-8-772868183 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed I'm having two problems extending the array class. First, I am getting instances where super == nil. It seems to me that this should be impossible. The code that results in super == nil is as follows: def TypedArray.initWithArray(parent, content) ta = TypedArray.new(parent) content.each() { |val| ta << val } return ta end When I take this returned object and run methods that access super, super will equal nil. For example: def [](colNum) puts ("******************super == nil") if super == nil; return super[@parent.colsIdx[colNum]] end The above method will print the "super == nil" string and throw the exception saying [] is not defined for nil. Second, I am redefining the [] and []= methods, so within those, I have to access super[]= and super[] (or else I'll have an infinite regress). For example: def []=(colNum, val) super[@parent.colsIdx[colNum]] = val end I am getting very odd results. For example, a[0] = "yet another test col 0" actually sets a[0] to "yet anothyet another test col 0r test col 0". Moreover, if I insert the following line: puts(super.type) I get "String" every time. These results strike me as anomalous and are too bizarre for me to explain, especially give the fact that my source code is rather rudimentary. I am using ruby 1.6.7 on MacOS X 10.2.3. I am using the version that came with the developer tools, and ruby --version gives me the following: ruby 1.6.7 (2002-03-01) [powerpc-darwin6.0] Thanks, Dave --Apple-Mail-8-772868183 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-disposition: inline content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (Darwin) iD4DBQE+EdkmRdirey0+rJARAvtVAJi6t23gD6tzyc78+XH/cu9W0Ba0AJ9efzED 41wpwdLP3/mH3tvFzcY23A== =UJKO -----END PGP SIGNATURE----- --Apple-Mail-8-772868183--