comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Simple Question 3
Date: Fri, 12 Oct 2001 17:03:22 GMT
Date: 2001-10-12T17:03:22+00:00	[thread overview]
Message-ID: <unFx7.7186$gT6.4972203@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: 9q6k2r$p8g$1@trog.dera.gov.uk

> >   X := Unit;
> > question: what is the value of X.c?
> I would have thought that the compiler should just through the assignment X
> := Unit() out, because it does not statically match.
  The compiler does indeed "throw out" the assignment statement.  It gives
you an error message saying it won't accept it.

> I do not see why the compiler has the right to demand you write a Unit()
> function for the derived type.  Is there a deeper reason why it does?
  The function Unit supplies values for everything in X except X.c
(the extension part).  The compiler thus has no way of knowing what
value it's supposed to give to X.c in the assignment.  Perhaps in
some languages the compiler would go ahead and let X.c take some
random value, but an Ada compiler is more helpful than that and tells
you that you are asking for garbage.  An Ada compiler is not a
dumb tool, like a hammer that can be used just as well on a thumb
as on a nail.  An Ada compiler is an assistant who helps you find
errors and won't deliver hammer blows to your thumb.



  reply	other threads:[~2001-10-12 17:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-11 14:28 Simple Question 3 Stephen Cole
2001-10-11 22:41 ` tmoran
2001-10-12 11:33   ` Stephen Cole
2001-10-12 17:03     ` tmoran [this message]
2001-10-14  7:51     ` Jean-Marc Bourguet
2001-10-12 13:33 ` David C. Hoos
2001-10-14 18:53 ` Stephen Cole
2001-10-14 20:45   ` Vincent Marciante
2001-10-14 21:00   ` Jeffrey Carter
2001-10-14 22:08     ` Stephen Cole
2001-10-15  6:26       ` Jeffrey Carter
2001-10-14 21:15   ` Primitive operations and derived types (Was: Simple Question 3) Jacob Sparre Andersen
2001-10-14 21:42   ` Simple Question 3 tmoran
2001-10-14 22:30     ` Stephen Cole
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox