comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: Q: Endless loop by dispatching
Date: Sat, 19 Jul 2003 00:25:13 GMT
Date: 2003-07-19T00:25:13+00:00	[thread overview]
Message-ID: <3F188FDA.3000202@attbi.com> (raw)
In-Reply-To: qKZRa.94454$H17.28822@sccrnsc02

tmoran@acm.org wrote:
>   What was programmer of Root trying to accomplish when he said
> 
>>  type Root_Type is tagged private;

He was trying to demonstrate an obscure point about the current 
definition of overriding.  I typically say that, for most Ada 
programmers 10% of the Reference Manual is relevant, the rest explains 
in gruesome detail what will happen if you try to shoot yourself in the 
foot. The ARG combs through that ninety percent, finds the one percent 
where it is not clear which foot you should hit and worries about it for 
years.  Example programs like this, and like most of the ACATS tests are 
about consistently hitting the same toe when you miss what you are 
aiming at.

Only a small very fun part of the job is adding new features to the 
language.  (But for every new useful feature, there are also at least 
ten new ways to shoot at your feet.   So the big part of the job is 
corralling all those nasal daemons.

>   It seems to me he was trying to say "If you declare a child type
> and procedures Initialize or Finalize or Adjust, don't expect them
> to be called as if Root_Type was Controlled.  If he wanted to let
> derived types be Controlled, he should have said:
> 
>>  type Root_Type is new Ada.Finalization.Controlled with private;

Could have, should have, will learn to.  All irrelevant, as I said, the 
discussion on this starts with the assumptions of gun and foot.  The ARG 
wants to make the foot smaller and the gun harder to point at your own 
body.  But we are only human, the solutions are imperfect, and somewhere 
out there is a bigger fool than I can imagine.  I have to content myself 
with saving those I can hope to understand.

There is another thread about let me find it:

--------- test.ads ---------

with System.Storage_Elements; use System.Storage_Elements;
package Test is
     type A is
	record
	    I: Integer;
	end record;
     B: A;
     J: Integer renames B.I;
     for J'Address use To_Address(0);
end Test;

---------------------------

What was the author of this code TRYING to do?  I have yet to answer 
that one.  If there is a real need here, I should try to find some 
answer other than, "You may be entitled to a better error message."

Does RM 13.3(12) explicitly disallow this case? Yes.

Address may be specified for stand-alone objects and for program units 
via an attribute_definition_clause.

Stand-alone object is a technical term defined in RM 3.3.1(1): "An 
object_declaration declares a stand-alone object with a given nominal 
subtype..."

Since J is declared by a renaming declaration, it is not a stand-alone 
object.

And per 13.3(5), the RM decides where a non-implementation defined 
attribute can appear in an attribute definition clause.

>>But to not be able to declare Leaf.Initialize
>>as overriding defeats the whole point.
> 
>   Defeats what point?

In this case the idea of extending the language to allow the programmer 
to state whether he expects the declaration to be overriding.  Making 
something overriding and only allowing a user to declare it as 
non-overriding clearly defeats that intent.  So most of the discussion 
is about how to allow these declarations to be true.  No, I'm not crazy 
and it is hard.  Remember any changes that affect real software out in 
the world require a huge benefit.  So we want to fix this without 
breaking what exists.

Note that for this particular example I wrote, whatever is decided will 
break it.  But that is fine.  It was written only for exploratory 
reasons, and whatever the final resolution is, ALL compilers will 
produce the same output.

-- 

                                                        Robert I. Eachus

�In an ally, considerations of house, clan, planet, race are 
insignificant beside two prime questions, which are: 1. Can he shoot? 2. 
Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and 
Steve Miller.




  reply	other threads:[~2003-07-19  0:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-11  8:22 Q: Endless loop by dispatching Michael Erdmann
2003-07-11  9:46 ` Jean-Pierre Rosen
2003-07-11 15:19   ` Michael Erdmann
2003-07-11 10:01 ` Q: " Dmitry A. Kazakov
2003-07-11 15:07   ` Michael Erdmann
2003-07-12  1:41     ` Jeffrey Carter
2003-07-14  8:48     ` Dmitry A. Kazakov
2003-07-14 18:38       ` Randy Brukardt
2003-07-15  8:47         ` Dmitry A. Kazakov
2003-07-15 17:23           ` Randy Brukardt
2003-07-16  8:08             ` Dmitry A. Kazakov
2003-07-16 17:44               ` Robert I. Eachus
2003-07-17  1:57               ` Robert A Duff
2003-07-18  9:10                 ` Dale Stanbrough
2003-07-18 20:26                   ` Robert I. Eachus
2003-07-18 21:35                     ` tmoran
2003-07-19  0:25                       ` Robert I. Eachus [this message]
2003-07-19  2:30                         ` tmoran
2003-07-19  5:48                           ` Robert I. Eachus
2003-07-21  8:38                             ` Dmitry A. Kazakov
2003-07-21 10:08                               ` Robert I. Eachus
2003-07-21 13:21                                 ` Dmitry A. Kazakov
2003-07-21 18:51                                   ` Robert I. Eachus
2003-07-22  7:41                                     ` Dmitry A. Kazakov
2003-07-22 10:36                                       ` Lutz Donnerhacke
2003-07-22 12:11                                         ` Dmitry A. Kazakov
2003-07-22 12:18                                           ` Lutz Donnerhacke
2003-07-22 14:46                                             ` Dmitry A. Kazakov
2003-07-22 15:11                                               ` Lutz Donnerhacke
2003-07-23  8:12                                                 ` Dmitry A. Kazakov
2003-07-19 14:44                     ` Chad R. Meiners
2003-07-20 12:36                       ` Robert I. Eachus
2003-07-11 16:27 ` T. Kurt Bond
2003-07-12  8:37   ` Michael Erdmann
2003-07-15  7:11     ` Kenneth Almquist
replies disabled

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