From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] A Plan 9 C request.... Date: Wed, 1 Mar 2006 18:17:57 +0000 From: rog@vitanuova.com In-Reply-To: <61438dea6b0a264f8225382d0c6e2d51@9netics.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 08358c0c-ead1-11e9-9d60-3106f5b1d025 > when it was added to C++, i "felt" that the scope > of 'i' wasn't natural; it goes beyond 'for's closure. > i like a behavior like this: > > { int i; for (i = 0, ...) ...; } when i first started to use Limbo, which has a similar looking idiom, i thought the same. for(i := 0; i < 10; i++) { } but actually, having the variable available outside the scope is so often useful, e.g. for(i := 0; i < end; i++) if(sometest()) break; if(i == end) fall_through_condition(); that i now think the non-scoping behaviour is the right thing. i'm not sure that it's worth adding to plan 9 C though.