comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Class-wide types algebra
Date: Tue, 13 Sep 2016 14:26:10 +0200
Date: 2016-09-13T14:26:10+02:00	[thread overview]
Message-ID: <nr8rah$14gp$1@gioia.aioe.org> (raw)
In-Reply-To: 2837d915-12c8-4c23-8907-1d146d1abae7@googlegroups.com

On 13/09/2016 13:46, rieachus@comcast.net wrote:

> IMHO the biggest problem in Ada is the namespace pollution of types.

That is not a problem either because resulted types are anonymous.

> Dotted notation is acceptable when package names hide each other,
> but  I hate having to write "subtype Foo is Bar.Foo."

Well that is another language problem that types cannot orderly be 
renamed. But I don't see how it is related to class-wide types. And type 
renaming is only a problem in generics which are beyond any hope anyway.

> Subprograms can be
> overloaded, but adding a (new) type name during maintenance can break
> something down a chain of derivations.

No, it cannot break anything, it is just like "access T", T'Base etc.

> A long time ago, Lori Clarke and others wrote: "Nesting in Ada is
> for  the Birds." http://dl.acm.org/citation.cfm?id=948651 There are a few
> missing pieces when you go to mix class wide types into Ada. I've
> started numbering the often never mentioned again types that appear when
> using interfaces to do mix-ins.

Yes, I have long proposed to introduce T'Interface to denote the type 
interface stripped of implementation. That will spare you many explicit 
interface declarations and fix language library problems. E.g.

    type Root_Stream_Type is ...

OK, that was a mistake, it should have been

    type Root_Stream_Interface is limited interface;
    type Root_Stream_Type is abstract new Root_Stream_Interface
       with private;

With T'Interface you could still work it around:

    type DB_Stream is new Data_Base_Connector -- I need my base type here
       and Root_Stream_Type'Interfrace; -- But it is a stream still

[Of course T'Interface will override abstract all non-abstract not null 
primitive operations inherited by T]

Of course:

T'Immediate_Parent to denote the parent type.
T'Element to denote array element type
T'Index to denote array index type
T'Member(Name/Position) to denote record member type
T'Constraints to denote a null record type with constraints of T
T'Target to denote the pointer's target type

Nothing of this would be any difficult, but it would make usage of 
generics a lot easier.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2016-09-13 12:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 20:26 Class-wide types algebra Dmitry A. Kazakov
2016-09-12 21:12 ` rieachus
2016-09-12 21:39   ` Dmitry A. Kazakov
2016-09-13 11:46     ` rieachus
2016-09-13 12:26       ` Dmitry A. Kazakov [this message]
2016-09-28  0:05         ` Randy Brukardt
2016-09-28  7:31           ` Dmitry A. Kazakov
2016-09-28 20:17             ` Randy Brukardt
2016-09-29  8:06               ` Dmitry A. Kazakov
2016-09-29 18:44                 ` Randy Brukardt
2016-09-29 19:55                   ` Dmitry A. Kazakov
2016-10-01  5:47                     ` Randy Brukardt
2016-10-01  8:35                       ` Dmitry A. Kazakov
2016-10-05 20:42                         ` 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