comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Design of Ada.Strings.Bounded
Date: 1997/07/11
Date: 1997-07-11T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680001107972025120001@news.ni.net> (raw)
In-Reply-To: 5q4mel$16r$1@goanna.cs.rmit.edu.au


In article <5q4mel$16r$1@goanna.cs.rmit.edu.au>, Dale Stanbrough
<dale@goanna.cs.rmit.EDU.AU> 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
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  reply	other threads:[~1997-07-11  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-11  0:00 Design of Ada.Strings.Bounded Dale Stanbrough
1997-07-11  0:00 ` Matthew Heaney [this message]
1997-07-13  0:00 ` Keith Thompson
1997-07-14  0:00   ` Matthew Heaney
1997-07-16  0:00     ` Keith Thompson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox