Re: Goto?
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.
Of course (as for goto targets), the values must be constants. Otherwise, it
becomes very difficult, as Bernie pointed out.
CChris
|
Not Categorized, Please Help
|
|