Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?ISO-8859-1?Q?Sven_K=F6hler?= Newsgroups: comp.lang.java.programmer Subject: Re: lectures about "programming methodology" Date: Tue, 07 May 2013 15:52:26 +0300 Lines: 26 Message-ID: References: <51885ce2$0$32110$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.dfncis.de Oha5JZLR+2UDCa5avRuTCQ+LQbME3v+Nqwt47Ob2UhSOy7RCLvJ2znKqIc Cancel-Lock: sha1:UhzIZd9k9v4rclL3SKppSV9eNx4= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130404 Thunderbird/17.0.5 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:23888 On 05/07/2013 03:45 PM, Stefan Ram wrote: > Sven Köhler writes: >> BTW: It is also possible to defend his description of the scope, namely >> if you limit it to local variables only (Stefan's counter example was a > > For local variables the two concepts differ too. One example > can already be seen in my code, when one reads the local > parameter »i« as a local variable. The most famous example > is the factorial (untested): > > int f( final int i ){ return i == 0 ? 1 : i * f( i - 1 ); } > > . To understand this, it is vital to understand that »i« has > only a single scope, but can have many (in this case: > nested) lifetimes. That is correct. But then again, I'm not sure how this professor will explain it. To be consistent with his definition of scope, he might explain to the students, that there are many "incarnations" of i, each "living" from the { to the }, i.e. the scope. In his way of thinking, this might be consistent with saying that the scope defines the lifetime of i (namely each incarnation of i). Regards, Sven