Re: Goto?
- Posted by Kat <KAT12 at coo??hs.net> May 12, 2008
- 707 views
CChris wrote: > > c.k.lester wrote: > > > > Jeremy Cowgar wrote: > > > > > > I have mixed emotions about it. Goto in some situations can be a very > > > valuable > > > construct but it can also be a construct that novice programmers can > > > really > > > get in trouble with causing hours of unnecessary debugging. > > > > I've never encountered a case where a goto is the best solution. Never. > > > > One thing I want to avoid on any interpreter upgrade is bloating the > > interpreter and/or slowing it down. If goto is going to be considered, I'm > > sure there are more popular options to be considered first. > > There is one frequent case where goto could be tempting: exiting nested loops > or if blocks. > > It would be very useful, and not very difficult, to implement an "exit n" or > "exit <loop_label" or exif for if blocks. This would be a valuable addition, > without any new keyword. In developing a syntactic parser, i discovered exponential explosions in possibilities, and 90% of them could be eliminated early in the reparse. Having a goto more than doubled parse speed and eliminated if-then flag tests all over the place. Had i been forced to use exit(n), i'd have needed to keep an eye on all exits every time i added or removed code during development. Kat