From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Class-wide types algebra Date: Tue, 13 Sep 2016 14:26:10 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <2837d915-12c8-4c23-8907-1d146d1abae7@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:31771 Date: 2016-09-13T14:26:10+02:00 List-Id: 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