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,5e54ec0ce937978 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: String literals and wide_string literals - how? Date: Fri, 20 Apr 2007 14:16:11 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1177063665.093083.241580@e65g2000hsc.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1177096456 32204 69.95.181.76 (20 Apr 2007 19:14:16 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 20 Apr 2007 19:14:16 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Xref: g2news1.google.com comp.lang.ada:15166 Date: 2007-04-20T14:16:11-05:00 List-Id: "Robert A Duff" wrote in message news:wccbqhjw0we.fsf@shell01.TheWorld.com... ... > String literals are not necessarily of type String; they can be of any > "string type". A string type is any one-dimensional array of some > character type. You can even do weird things like this: > > type Bit is ('0', '1'); That's not that weird. My favorite example of this came from an early Ada 83 book: type Roman_Digit is ('I', 'V', 'X', 'L', 'C', 'D', 'M'); type Roman_Numeral is array (Positive range <>) of Roman_Digit; Five : constant Roman_Numeral := "V"; Sixteen : constant Roman_Numeral := "XVI"; My_Age : constant Roman_Numeral := "XLVIII"; Claw_Generic_Price : constant Roman_Numeral := "CDXCV"; Claw_Support_Price : constant Roman_Numeral := "CCC"; Now throw in some operator overloading: function "+" (Left, Right : Roman_Numeral) return Roman_Numeral; and you can work solely in Roman_Numerals. Total : constant Roman_Numeral := Claw_Generic_Price + Claw_Support_Price; Cool, even if rather useless. (I don't think I'd want to try to calculate sales tax this way!!) Randy.