From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c3095e7116890a3 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: loop and block question Date: 1997/01/29 Message-ID: #1/1 X-Deja-AN: 213034349 references: <1997Jan29.171423.3481@news.nbi.dk> <2svi8g5rzr.fsf@hp755d2.eurocontrol.fr> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1997-01-29T00:00:00+00:00 List-Id: In article <2svi8g5rzr.fsf@hp755d2.eurocontrol.fr>, Steve Jones - JON 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