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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request Date: Wed, 15 Sep 2004 14:50:42 +0200 Message-ID: <1g4ke94bjxhrs$.1b0ed5uhayvec$.dlg@40tude.net> References: <49dc98cf.0408110556.18ae7df@posting.google.com> <17sx057ro5jw5$.t2qlaeoxg611$.dlg@40tude.net> <1095082522.132276@master.nyc.kbcfp.com> <18ym85v67zof3$.7oqswzjfgswr.dlg@40tude.net> <1095090665.624419@master.nyc.kbcfp.com> <68zmgy3b894u.rs67cy6jjfiq$.dlg@40tude.net> <11tjdpsch74g0.158lc7jpe3vz5$.dlg@40tude.net> <1782038.ine8gsgUCE@linux1.krischik.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de artCQ+UpWD6YspYoieo98A5YABQ9Webh+pCOBbLV1M/th5Dfs= User-Agent: 40tude_Dialog/2.0.12.1 Xref: g2news1.google.com comp.lang.ada:3754 Date: 2004-09-15T14:50:42+02:00 List-Id: On Wed, 15 Sep 2004 12:14:31 +0200, Martin Krischik wrote: > Dmitry A. Kazakov wrote: > >> Should it be generic, parametrized by a >> string type. Which is BTW impossible too, because even at the level of >> generics the least common ancestor of all Ada string types is "type Duno >> is private"; > > I think you have not worked enough with generics. > > generic > > type Character_Type is (<>); > > type String_Type is array (Positive range <>) of Character_Type; > > package Some_Generic_String_Operations > > But there is a problem of course: Unbounded_String is not a generic > instantiation. It really should have been: > > package Unbounded_String > is new Generic_Unbounded_String ( > Character_Type => Character, > String_Type => String); > > package Wide_Unbounded_String > is new Generic_Unbounded_String ( > Character_Type => Wide_Character, > String_Type => Wide_String); They couldn't do it, because of ranges/slices/attributes. They are not first class citizens, alas. Then it could be: generic -- This is not Ada! type Index_Type is (<>); type Index_Range_Type is range of Index_Type; type Element_Type is private; type Array_Type is array (Index_Type range Index_Range_Type) of Element_Type; package Abstract_Array is ... Anyway, an equivalent, but more straightforward way is just to make Unbounded_String matching type String_Type is array (Positive range <>) of Character_Type; Once, you solved the problem of wired slices and attributes, the rest will be easy. > And sadly it is to late for that. Not at all. Solve the above and add supertypes. That will do the trick. You create a common array ancestor *afterwards* and everybody is happy. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de