Re: goto considered essential
Tom Dailey wrote:
>
>
> Jason:
>
> Thank you for your detailed reply.
>
> You characterize errors as falling into two categories,
> at least in the context of this discussion. But I submit
> that there is a third category, at least from the
> viewpoint of a function that detects an error. In
> this category are errors that are to be handled by the
> caller. The function itself neither panics nor performs
> recovery, but simply reports the error to the caller.
> It is this class of errors that concern me most here,
> insofar as code clarity is concerned. For such situations,
> gotos (or something like them) are really the only answer --
> unless one defines a full-blown nonlocal goto semantics,
> like Java or Ada exceptions, or PL/I on-units.
>
> Tom
Yes, I consider those to be "recoverable" errors, whether they are handled by
the caller or by the callee or by a more generic function.
The one instance where I can see goto being useful is where you have several
conditions or loops and they all have to jump to the same point on an exception.
I would like to see better handling of jumping out of nested loops (continue x
levels or exit x levels) but I don't know how likely that will be.
--
"The author regrets that he is unable to reconcile himself to the
thoughtful point of view you have expressed. However, it must be kept
in mind that being raised in different cultures and different places can
result in such differences of viewpoint between individuals.
The author is from planet Earth." [author unknown]
j.
|
Not Categorized, Please Help
|
|