comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: An improved Ada?
Date: Wed, 29 Sep 2004 16:33:25 -0500
Date: 2004-09-29T16:33:25-05:00	[thread overview]
Message-ID: <GsidnXZrU-JCtMbcRVn-tA@megapath.net> (raw)
In-Reply-To: 311c6b78.0409290905.15ae255d@posting.google.com

"jn" <jonas.nygren@telia.com> wrote in message
news:311c6b78.0409290905.15ae255d@posting.google.com...
> I got into a container discussion which was not the intention.
>
> I want improved OO capabilities in Ada. The way things are results
> in having to 'with' base class packages because not all methods seems
> to be inherited and also a lot of meaningless safe type conversions that
> should have been done by the compiler (my opinion) instead of the
programmer.

All methods that are in the base package are inherited. You seem to be
expecting the named types that happen to use the type to be automatically
inherited as well, but these are separate types. To do that in general would
be a complete nightmare.

Ada 95 does have a problem with use clauses. Ada 2005 solves this with the
prefix call notation:

   Obj.Subprog (...)

I'd suggest that your example be written the way real programs are (one
tagged type per package), because you can cause problems simply by putting
multiple types in one package. I'd also ask that you add comments about what
you would expect to be inherited. Otherwise, we can't quite tell what you
have in mind.

> Are there really any codebases that
> applies 'tagged' types and type extension on a larger scale. Not just
> wrapping it up in generics.

Claw has about 75 tagged types derived in various chains from
Root_Window_Type (a tagged abstract type); each of those types resides in
its own package.

The Claw Builder has a similar structure mirroring that sort of derivation.

Virtually all type conversions that we had to write in both of those are not
"safe"; they include a check of some sort that we do not expect to fail. But
converting from Root_Window_Type'Class to some specific type clearly should
be marked in the code.

                       Randy.






  parent reply	other threads:[~2004-09-29 21:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-27 19:38 An improved Ada? jn
2004-09-27 20:40 ` Matthew Heaney
2004-09-28 20:41   ` Wojtek Narczynski
2004-09-28 22:54     ` Randy Brukardt
2004-09-28  5:45 ` Matthew Heaney
2004-09-29 17:05 ` jn
2004-09-29 18:26   ` Matthew Heaney
2004-09-29 21:33   ` Randy Brukardt [this message]
2004-09-29 22:15     ` tmoran
2004-09-30 16:55       ` tmoran
replies disabled

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