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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a5cdfaf37bba8923 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Design of Ada.Strings.Bounded Date: 1997/07/11 Message-ID: #1/1 X-Deja-AN: 256314630 Distribution: world References: <5q4mel$16r$1@goanna.cs.rmit.edu.au> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-07-11T00:00:00+00:00 List-Id: In article <5q4mel$16r$1@goanna.cs.rmit.edu.au>, Dale Stanbrough wrote: >After contemplating how i would use Ada.Strings.Bounded, i wondered about >the decisions that were made when it was designed. > >If I use it in a package, and want to add any additional features, or >use it as a parameter type > >e.g. > function Check_Spelling (Item : Bounded_80) return Boolean; > >then this is rather unfortunate when i want to check the spelling >of an item in a Bounded_81 string. This is exactly the same problem >that we had in Pascal, that unconstrained types in Ada solved. Declare your subprogram as a generic, and import the instantiation of Generic_Bounded_Length: generic with package Bounded_Strings is new Ada.Strings.Bounded.Generic_Bounded_Length (<>); use Bounded_Strings; function Generic_Check_Spelling (Item : Bounded_String) return Boolean; QED. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271