From: "Michael T. Richter" Date: 2007-08-31T10:54:08+09:00 Subject: Re: Why stack overflow with such a small stack? --=-7wMIjPcAi0BBbND2LmuI Content-Type: multipart/alternative; boundary="=-nABF0ddsLU90pftgbg5Q" --=-nABF0ddsLU90pftgbg5Q Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2007-31-08 at 10:35 +0900, Kenneth McDonald wrote: > To a newcomer, it's sorta nonobvious, however--it turned out the problem=20 > was that I'd made a circular reference to 'values' instead of '@values',=20 > and the fact that the stack was full of 'values' frames is certainly not=20 > obvious from the above. A good rule of thumb for avoiding this problem is to name your classes and your variables after nouns and your methods after verbs. So instead of having a method "values" that uses the member "@values" -- something pretty much guaranteed to lead to trauma at some point down the road -- make a method "get_values" or "set_values" or "initialize_values" or whatever that uses a member called @values. --=20 Michael T. Richter (GoogleTalk: ttmrichter@gmail.com) Experts in advanced countries underestimate by a factor of two to four the ability of people in underdeveloped countries to do anything technical. (Charles P Issawi) --=-nABF0ddsLU90pftgbg5Q Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, 2007-31-08 at 10:35 +0900, Kenneth McDonald wrote:
To a newcomer, it's sorta nonobvious, however--it t=
urned out the problem 
was that I'd made a circular reference to 'values' =
instead of '@values', 
and the fact that the stack was full of 'values' fr=
ames is certainly not 
obvious from the above.

A good rule of thumb for avoiding this problem is to name your classes and = your variables after nouns and your methods after verbs.

So instead of having a method "values" that uses the member "= ;@values" -- something pretty much guaranteed to lead to trauma at som= e point down the road -- make a method "get_values" or "set_= values" or "initialize_values" or whatever that uses a membe= r called @values.

--
Michael T. Richter <ttmri= chter@gmail.com> (GoogleTalk: ttmrichter@gmail.com)
Experts in advanced countries underestimate by a factor of two to four t= he ability of people in underdeveloped countries to do anything technical. = (Charles P Issawi)
--=-nABF0ddsLU90pftgbg5Q-- --=-7wMIjPcAi0BBbND2LmuI Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQBG13SyLqyWkKVQ54QRAj8XAJ9G8w2npeOkDF3IhMtBrS64nDgo+QCeLRqw 6gBM+PO6beEjP8xHu8D/YEA= =fgY1 -----END PGP SIGNATURE----- --=-7wMIjPcAi0BBbND2LmuI--