From: bobduff@world.std.com (Robert A Duff)
Subject: Re: loop and block question
Date: 1997/01/29
Date: 1997-01-29T00:00:00+00:00 [thread overview]
Message-ID: <E4s81p.E7D@world.std.com> (raw)
In-Reply-To: 2svi8g5rzr.fsf@hp755d2.eurocontrol.fr
In article <2svi8g5rzr.fsf@hp755d2.eurocontrol.fr>,
Steve Jones - JON <jon@hp755d2.eurocontrol.fr> wrote:
>You have reused Some_Loop_Name these labels should be unique just like the
>compiler output tells you. Having never used the dreaded GOTO I cannot
>be certain but I think that this is what the Labels COULD be used for
>(if you wanted to die a slow and painful death).
No. Goto labels have a different syntax from loop names (and that's
good). But they both have to follow the same unique-within-procedure
rule.
>Now a question, why does Ada have GOTOs,
Hey, are you trying to start a war? ;-)
>... why does code need to be changed
>to avoid GOTOs problems ?
Good question. I'm not entirely sure why loop and block names have to
obey the same rules as goto labels.
>... I remember having a bunch of exception handling
>blocks within a case statement, I had to create individual names for
>each one rather than just using a unified label (eg Exception_Block)
>we can overload everything BUT labels.
No. At a given place in your code, you cannot overload two names,
unless *both* are subprograms. This is a design principle of Ada 83,
for better or worse. And to get around, the language definition
pretends that enumeration literals are "really" functions. And to get
around it in a different way, integer literals are of some magical type
called universal_integer, and implicit conversions happen.
>GOTO has unusual syntax so why not specific GOTO Labels ?
The syntax of goto labels is different. But goto labels occupy the same
namespace as everything else. You can't have a variable called X and a
label called X in the same scope. Are you saying that should be
allowed, and that overload resolution should distinguish "X := 1" and
"goto X;"? IMHO, making the overload resolution rules too smart is not
a good idea.
- Bob
next prev parent reply other threads:[~1997-01-29 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-29 0:00 loop and block question Jacob Sparre Andersen
1997-01-29 0:00 ` Steve Jones - JON
1997-01-29 0:00 ` Robert A Duff [this message]
[not found] ` <E4wHKC.FB5@thomsoft.com>
[not found] ` <32F3D3BA.4B88@ssf.fi>
[not found] ` <E4yCBo.FrC@world.std.com>
1997-03-16 0:00 ` Niklas Holsti
1997-01-29 0:00 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox