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,c40a80666be78948 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Elemantary Ada question Date: 2000/11/28 Message-ID: #1/1 X-Deja-AN: 698719217 Sender: bobduff@world.std.com (Robert A Duff) References: <9008uq$hmi$1@news.uit.no> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-11-28T00:00:00+00:00 List-Id: reinert@ola.npolar.no (Reinert Korsnes) writes: > Can anybody explain me why "A : Float" conflicts > with the declaration: "type E1 is (a, b, c);" ? Enumeration literals are overloadable, but variables are not overloadable. You are not allowed to have a non-overloadable A if there is some other A in the same scope (even if the other one is overloadable). The exact rules are in chapter 8 of the RM. It says that two declarations with the same name are "homographs" if one or both are non-overloadable. Also, if both are overloadable, and have the same parameter and result types (where the enumeration literal A is like a parameterless function returning type E1). It is illegal to have two homographs in the same "declarative region". Or perhaps you are asking why was the language defined that way. Well, variable names could be overloadable, and the language rules would work just fine. The above would be legal, and things like X: E1 := A; would resolve to the right A. Things like "if A = A..." would be ambiguous, and therefore illegal. - Bob