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,9464f7990925623f X-Google-Attributes: gid103376,public From: Keith Thompson Subject: Re: Attempting to modify a function result Date: 1999/07/22 Message-ID: #1/1 X-Deja-AN: 504167020 References: <3797103C.4FD5@nospam.boeing.com> <37976216.7454C725@mitre.org> X-Complaints-To: usenet@nusku.cts.com X-Trace: nusku.cts.com 932680197 25061 198.68.168.21 (22 Jul 1999 21:49:57 GMT) Organization: CTS Network Services NNTP-Posting-Date: 22 Jul 1999 21:49:57 GMT Newsgroups: comp.lang.ada Date: 1999-07-22T21:49:57+00:00 List-Id: "Robert I. Eachus" writes: > "Raymond C. Rawa" wrote: > > I've encountered a "feature" of Ada83 or the VADS compiler that I don't > > understand. > > It is a feature of Ada, not just VADS. > > > ...Display.a := 5; -- I mean't to type: The_Display.a := 5; > > Display is a function that returns an object of type Display_Type. > Display.a is a compontent of that object of type Integer, which gets > assigned the value 5. What is hard about that? That doesn't mean you can legally assign to it. RM95-6.4(12) says A function_call denotes a constant, as defined in 6.5; the nominal subtype of the constant is given by the result subtype of the function. I couldn't find quite as clear a statement in RM83, but RM83-6.5 says A function is a subprogram that returns a value (the result of the function call). As I understand it, a value is not an object. Now, if the Display function returned an access value, "Display.a := 5" could implicitly dereference the result and assign a value to the component "a", but that's not what's happening here. Looks like a bug in VADS to me. -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> One of the great tragedies of ancient history is that Helen of Troy lived before the invention of the champagne bottle.