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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.180.23.103 with SMTP id l7mr8535026wif.6.1380048226667; Tue, 24 Sep 2013 11:43:46 -0700 (PDT) X-Received: by 10.152.45.105 with SMTP id l9mr6808lam.33.1380048226424; Tue, 24 Sep 2013 11:43:46 -0700 (PDT) Path: backlog2.nntp.ams3.giganews.com!backlog2.nntp.ams2.giganews.com!backlog2.nntp.ams.giganews.com!backlog2.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!g3no12820084wic.0!news-out.google.com!ed8ni222313wic.0!nntp.google.com!gn7no9878242wib.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Sep 2013 11:43:45 -0700 (PDT) In-Reply-To: <9afe7143-873f-4ae9-a387-424a9f858827@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=RxNzCgoAAACA5KmgtFQuaU-WaH7rjnAO NNTP-Posting-Host: 66.126.103.122 References: <9afe7143-873f-4ae9-a387-424a9f858827@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <052de5da-75dc-486b-83e9-4f717d8e0ab7@googlegroups.com> Subject: Re: Ambiguous expressions - Help! From: Adam Beneschan Injection-Date: Tue, 24 Sep 2013 18:43:46 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:183442 Date: 2013-09-24T11:43:45-07:00 List-Id: On Tuesday, September 24, 2013 11:15:35 AM UTC-7, Eryndlia Mavourneen wrote= : > On Tuesday, September 24, 2013 12:38:34 PM UTC-5, Mike H wrote: > > I find it hard to believe that the compiler cannot distinguish between = a > > string and an array of characters. What am I doing wrong? > An Ada String *is* an array of characters. I didn't realize it, but appa= rently the String constant (in quotes) can be converted automatically into = any vector of characters, even those not declared explicitly as "String"s. A string literal can actually be converted to any array of an enumeration t= ype, if the enumeration type has at least one character literal as one of i= ts literals. The classic example is: type Roman_Digit is ('I', 'V', 'X', 'L', 'C', 'D', 'M'); type Roman_Numeral is array (Natural range <>) of Roman_Digit; R : Roman_Numeral :=3D "MMXIII"; Roman_Numeral is called a "string type". String, Wide_String, and Wide_Wid= e_String are other string types, as is Foo1.Grid_Type in the question. When a string literal can be converted to more than one string type, it's a= mbiguous. This does cause problems when there are two overloaded subprogra= ms where one has a String parameter and another has a Wide_String or Wide_W= ide_String parameter; the use of the string literal is ambiguous. As Jeff = answered, you have to specify which type you want: Foo2.Put_Line (Item =3D> String'("Something else")); Foo2.Put_Line (Item =3D> Foo1.Grid_Type' ("Something else")); -- Adam