--Apple-Mail-9-773387751 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed I just compiled and installed Ruby 1.6.8 from source, and I get the same problems. On Tuesday, December 31, 2002, at 12:51 PM, David Landrith wrote: > 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 > <PGP.sig> ------------------------------------------------------- David King Landrith (w) 617.227.4469x213 (h) 617.696.7133 One useless man is a disgrace, two are called a law firm, and three or more become a congress -- John Adams ------------------------------------------------------- public key available upon request --Apple-Mail-9-773387751 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) iD8DBQE+EdsuRdirey0+rJARAm1lAJ9cSUqHmLMKh+u5B7JaZg3k96rBywCeOaex KUI1s9F5F6i6R0V9D4UFxm8= =ptHk -----END PGP SIGNATURE----- --Apple-Mail-9-773387751--