Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!ames!uhccux!munnari.oz.au!mimir!hugin!augean!mpope From: mpope@augean.OZ (Michael T Pope) Newsgroups: comp.lang.c++ Subject: Re: scope of FOR Summary: Save the classic |for| Message-ID: <573@augean.OZ> Date: 23 Aug 89 13:08:05 GMT References: <1807@hcr.UUCP> <9803@alice.UUCP> Reply-To: mpope@augean.OZ (Michael T Pope) Organization: U.of.Adelaide, E&E Engineering Lines: 39 In article <9803@alice.UUCP> ark@alice.UUCP (Andrew Koenig) writes: >In article <1807@hcr.UUCP>, ron@hcr.UUCP (Ron Irvine) writes: > >> This would let programmers localize the extent of the declared >> variable to the FOR statement. Bjarne could you please fix this. > >Sorry, it's too late. > >While working on 2.0 we seriously considered fixing it -- >until we discovered how much existing code it would break. Thankyou. I would have been bitten hard by that. However, in what way would one "fix" it? Surely one does not want to replace the simplicity of--- for (;;) ---being equivalent to--- ; for (;;) ---with some new special case behaviour? Is there currently anywhere in the language where scope is defined by anything other than {}s and explicit declaration keywords? (Well... ignoring file boundaries and function declarations:-) If not, now is a bad time to start. Admittedly the for(...) syntax could be criticized as potentially misleading, but since the scope of those declarations can be restricted trivially by wrapping the whole |for| in an extra pair of {}s the idea looks like mere syntactic sugar to me. Please dont break |for|. If restricted scope loop variables are really desirable, better to invent a new keyword/syntax. Cheers, Mike Pope