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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,604e0f87aa06eab6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-22 01:03:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!dialin-145-254-037-059.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Imitation is the sincerest form of flattery Date: Sat, 22 Mar 2003 10:04:58 +0100 Organization: At home Message-ID: References: <1047665830.579605@master.nyc.kbcfp.com> <7eee7v4hpvj0i5s345uonlen5315rhiau8@4ax.com> <1ec946d1.0303201528.6c9b2c9e@posting.google.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-037-059.arcor-ip.net (145.254.37.59) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1048323793 77808334 145.254.37.59 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:35615 Date: 2003-03-22T10:04:58+01:00 List-Id: Georg Bauhaus wrote: > Dmitry A. Kazakov wrote: > :>package P is > :> > :> type Unbounded_String (<>) is private; > :> > :>private > :> > :> type Unbounded_String is > :> array (Positive range <>) of Character; > :> > :>end P; > : > : This would be a private type implemented by an array, but not an array > : implemented by some other type. > > Where will this leed coders and readers? If I understand correctly, > what you want is an option to have objects with array access (attributes > etc.) that need not be arrays, privately. The same for other "ADTs" > that are provided by the language. That is, an option to override the > compilers regular job? When it is necessary. For example: type Handle is private access Object; private : type Handle is record ...; -- A fat smart pointer implementation With full ADT supported, the compiler might become even more lightweighted, because many things could be then moved to libraries. At least when one sees the invasion of gemetrically exploding Wide**N x {Unbounded | Bounded | Fixed} Strings... > I'd prefer considering a rule that said, 'No arrays at all, please, > in specs!' :-) Well, the number of predefined interfaces (ADT) can be reduced. However, an array thing is a very fundamental concept which has its place. Array in specification should only mean that you can index, get slice, have aggregates, get bounds. String is definitely an array. > In Eiffel, the basic types can be extended, and you can have > a sparse matrix derived from an ARRAY2, if you want to provide > your own implementation details, I think. Yes, this is IMO a good approach, as opposed to C++'s riddle game: I wrote something, go figure out where it might fit. However "extension" is a wrong word. Implementation of an interface is not an "extension". The language may have a sort of universal array type. The predefined array types and user-defined ones have to be derived from it and then cloned (by "type X is new Y;"): type My_Array is array ...; a short cut for type is new Universal_Array with ...; type My_Array is new ; > If, for a moment, you do not insist on arrays being suitable ADTs > for public access in specs, you can do that in Ada too, of course. > (With tagged types or with formal generics describing the "array like" > interface, which is not possible in Eiffel other than using FUNCTION > types(?), afaics.) If arrays are not suitable for specifications, then why the language has them? It is not a very good idea to have two different languages for specifications and implementation. At least because this separation is by no means absolute. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de