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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-09 00:43:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!area.cu.mi.it!newsfeeder.edisontel.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: Thu, 09 Oct 2003 09:52:29 +0200 Message-ID: References: <3F7B1076.8060106@comcast.net> <5mknnv4u96qqudrt4bd8n4t1cljp2fjlp8@4ax.com> <3F7C810E.7070100@comcast.net> <3F7E25C1.1060509@comcast.net> <3F7ECF99.8090004@comcast.net> <8qm2ov43djse19is7pk79jf5p7ifvvuff2@4ax.com> <3F841C3D.30007@comcast.net> <3F849F9F.7040108@comcast.net> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1065685383 18965008 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:519 Date: 2003-10-09T09:52:29+02:00 List-Id: On Wed, 08 Oct 2003 23:37:29 GMT, "Robert I. Eachus" wrote: >Dmitry A. Kazakov wrote: > >> A clear deficiency is an inability to constrain [*all*] the array >> elements through a discriminant. >> >> This in turn makes a non-generic implementation of Bounded_String less >> usable. An example of use: >> >> type Array_Of_Bounded_Strings (Max_Length : Natural) is >> array (...) of Bounded_String (Max_Length); >> >> Where is any limit here? > >Um, that the syntax is not legal Ada? Of course it is not. Arrays cannot have discriminants. >If you look at my recent post you >will see that you can do something which actually creates what you want. I do not want a concrete object. I want a regularity. Array of bounded strings was just an incidental example to bring this issue up. Much more interesting to me would be arrays of: 1. tagged elements, having discriminants 2. class-wide elements, which tags are constrained by the array discriminants 3. dimensioned values. Consider: type Dimensioned (SI : Unit) is record Value : Float; end record; type Vector (SI : Unit) is array (...) of Dimensioned (SI); type Matrix (SI : Unit) is array (..., ...) of Dimensioned (SI); etc. Moreover I would propose that *any* type should be allowed to have discriminants. Examples: type Dimensioned (SI : Unit) is new Float; type Vector (SI : Unit) is array (...) of Dimensioned (SI); type Hard_Coded_String (L, U : Integer) is access all Character; type Dynamically_Constrained_Value (L, U : Integer) is new Integer; >And notice that since the type Bounded_Array is totally non-generic, >you can write a function that returns an object of type Bounded_Array >assign it to a variable, then operate on that: > >Name_List: Bounded_Array := Get_Names(...); Mmm, I found no Bounded_Array definition in your earlier posts, but I assume it was Ragged_Array. >Since Name_List will take its bounds from the return value of Get_Names, >Get_Names can be written to return a Bounded_Array where the maximum >length is chosen based on the strings to be returned. To go back to an >earlier question, if your query matches twelve names, and the longest >name matched has length 31, then Name_List.Size = 12, and Name_List.Max >= 31. And with Ragged_Array it won't work. With Array_Of_Bounded_Strings it will. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de