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,20bf0d0544bba2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-09 09:04:13 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!netnews.web.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Declaring subtypes Date: Tue, 09 Dec 2003 18:01:21 +0100 Organization: AdaCL Message-ID: <1562855.YWiB7izfnf@linux1.krischik.com> References: <95476e79.0312090710.68a031a4@posting.google.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1070989420 05 23955 aULbGALLvaXvSyqN 031209 17:03:40 X-Complaints-To: usenet-abuse@t-online.de X-ID: ThVmIOZTreOwzQUYh5cakEi377n+IUKdCkGES8Pj6pYXLioOqkry0O User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:3284 Date: 2003-12-09T18:01:21+01:00 List-Id: Kevin Hostelley wrote: > I am rather new to Ada and I had a design question. I'm working on a > web based application and I was wondering if declaring subtypes of > String for common database fields was overkill. For example: > > subtype Address_Line is String(1..60); > subtype City is String(1..40); > subtype Zip_Code is String(1..9); > > > I understand that Strong typing is one of the strengths of Ada but I > just don't know how far to go with it. Click here for enlighenment: http://www.adaic.org/standards/95lrm/html/RM-A-4-4.html http://www.adaic.org/standards/95lrm/html/RM-A-4-5.html Strings are goot for interfaces like: -- -- Set Search Text -- procedure Set_Search ( -- Object itself. This : in out Object; -- New sarch text Search : in String) is begin This.Search := Ada.Strings.Unbounded.To_Unbounded_String (Search); end Set_Search; -- -- Get Search Text -- function Get_Search ( -- Object itself. This : in Object) return String is begin return Ada.Strings.Unbounded.To_String (This.Search); end Get_Search; But not for actulay storing data. With regards Martin -- mailto://krischik@users.sourceforge.net http://adacl.sourceforge.net