From: Keith Thompson <kst@cts.com>
Subject: Re: Attempting to modify a function result
Date: 1999/07/22
Date: 1999-07-22T21:49:57+00:00 [thread overview]
Message-ID: <yec673cwe0r.fsf@king.cts.com> (raw)
In-Reply-To: 37976216.7454C725@mitre.org
"Robert I. Eachus" <eachus@mitre.org> 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 <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
One of the great tragedies of ancient history is that Helen of Troy
lived before the invention of the champagne bottle.
next prev parent reply other threads:[~1999-07-22 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-07-22 0:00 Attempting to modify a function result Raymond C. Rawa
1999-07-22 0:00 ` Pascal MALAISE
1999-07-23 0:00 ` Raymond C. Rawa
1999-07-22 0:00 ` Robert I. Eachus
1999-07-22 0:00 ` Keith Thompson [this message]
1999-07-23 0:00 ` John Herro
1999-07-26 0:00 ` Tucker Taft
1999-07-27 0:00 ` Ehud Lamm
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox