comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Blaak <blaak@infomatch.com>
Subject: Re: Constructors/Destructors in Ada95
Date: 2000/10/24
Date: 2000-10-24T00:00:00+00:00	[thread overview]
Message-ID: <m3hf615s3n.fsf@ns57.infomatch.bc.ca> (raw)
In-Reply-To: 39F4AE95.4DB04145@bigfoot.com

Francois Godme <fgodme@bigfoot.com> writes:

> I. Non-primitive procedures used as constructors of limited instances: As
> limited instances can't be initialized with record aggregates, it is possible
> to write code which forgets to initialize all record fields.

Forgetting to initialize a field is equivalent to using a default constructor,
no? In that case the Initialize routine can cover it.

If not field is not a tagged type, either a default component assignment can
cover it, or if limited, the compiler should flag an error that the item is not
created.

I do grant you, however, that C++'s constructors are nice for forcing an item
to be created in only valid ways.

> II.The Adjust procedure: Efficiency concerns may be raised against the
> sequence: Finalize (Target); shallow copy Source into Target; Adjust
> (Target);.

I really would like to be able to do:

  procedure ":="(target : in out T; source : in T);

so as to have complete control over what is happening. I vaguely recall some
rationale from the Ada 9X discussions for why user-defined assignment per se
was not incorporated. Does anyone remember?

> III. The Finalize procedure:
> The programmers are responsible in the Finalize procedure to call last the
> immediate super-class Finalize procedure. As the notion of immediate
> super-class does not exist in the language, it is not possible to write code
> that will always call the Finalize procedure of the immediate super-class.

Not just in Ada. This bug has bitten me in C++ too often during redesign
times. Java's "super" and Delphi's "inherited" keywords neatly make this issue
go away.

Anyone know of a reason why "super" would not be a good idea for Ada 0X?

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@infomatch.com                            The Rhythm has my soul.




  reply	other threads:[~2000-10-24  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-18  0:00 Constructors/Destructors in Ada95 Francois Godme
2000-10-19  0:00 ` Ted Dennison
2000-10-19  0:00 ` Marin David Condic
2000-10-19  0:00 ` tmoran
2000-10-19  0:00   ` Francois Godme
2000-10-19  0:00     ` Ted Dennison
2000-10-20  0:00     ` Tucker Taft
2000-10-20  0:00       ` Francois Godme
2000-10-21  0:00         ` Marin David Condic
2000-10-23  0:00       ` Francois Godme
2000-10-24  0:00         ` Ray Blaak [this message]
2000-10-25  0:00           ` Francois Godme
2000-10-25  0:00           ` Marin David Condic
2000-10-25  0:00             ` dmitry6243
2000-10-25  0:00               ` Pascal Obry
2000-10-26  0:00                 ` dmitry6243
2000-10-25  0:00               ` mark.biggar
2000-10-26 11:44                 ` dmitry6243
2000-10-26 13:25                   ` Robert A Duff
2000-10-27  8:10                     ` dmitry6243
2000-10-26 17:55                   ` tmoran
2000-10-27  8:10                     ` dmitry6243
2000-10-26 21:31                 ` Tucker Taft
2000-10-27  8:46                   ` dmitry6243
2000-10-27  7:12             ` Ray Blaak
2000-10-27 18:11           ` Francois Godme
2000-10-30 11:36             ` Robert A Duff
2000-10-30 22:03               ` dale
2000-10-22  0:00     ` rwilson007007
2000-10-22  0:00       ` Francois Godme
2000-10-24  0:00         ` rwilson007007
  -- strict thread matches above, loose matches on Subject: below --
2000-10-29 22:51 rwilson007007
2000-10-30  4:03 ` Ray Blaak
2000-10-30 12:13 ` Marin David Condic
2000-10-30 16:39   ` Randy Brukardt
replies disabled

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