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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, URI_TRY_3LD,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a37:e30b:: with SMTP id y11mr73306698qki.100.1560810706077; Mon, 17 Jun 2019 15:31:46 -0700 (PDT) X-Received: by 2002:a9d:6289:: with SMTP id x9mr13882133otk.82.1560810705662; Mon, 17 Jun 2019 15:31:45 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!j96no4746058qte.0!news-out.google.com!4ni49qtw.1!nntp.google.com!j96no4746054qte.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 17 Jun 2019 15:31:45 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=200.20.225.239; posting-account=1Xv-6QoAAACDoVuHxsOQybzr2Y_PgwKz NNTP-Posting-Host: 200.20.225.239 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Doubts on Function Overloading From: =?UTF-8?Q?Ricardo_Brand=C3=A3o?= Injection-Date: Mon, 17 Jun 2019 22:31:46 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3248 X-Received-Body-CRC: 3277433864 Xref: reader01.eternal-september.org comp.lang.ada:56668 Date: 2019-06-17T15:31:45-07:00 List-Id: Hi, In the very first program I tried after finish the tutorial from Learn.Adac= ore.com I got some compile errors related to Overloading. My idea was verify how Ada deal with JSON. So, I found out this program [1]= . I created a project on GPS, included GnatCool as dependence, and when I tri= ed to compile, I got the error: =CE=BB gprbuild.exe main.adb using project file adajson.gpr Compile [Ada] main.adb main.adb:16:11: ambiguous call to "Set_Field" main.adb:16:11: possible interpretation at gnatcoll-json.ads:317 main.adb:16:11: possible interpretation at gnatcoll-json.ads:323 main.adb:30:11: ambiguous call to "Set_Field" main.adb:30:11: possible interpretation at gnatcoll-json.ads:317 main.adb:30:11: possible interpretation at gnatcoll-json.ads:323 gprbuild: *** compilation phase failed The source code is: 13 Penguin.Set_Field (Field_Name =3D> "name",=20 14 Field =3D> "Linux"); 15=20 16 Penguin.Set_Field (Field_Name =3D> "born", 17 Field =3D> 1992); 28 Penguin :=3D Read (JSON_String, "json.errors"); 29=20 30 Penguin.Set_Field (Field_Name =3D> "born", 31 Field =3D> 1986); The source code of gnatcool-json.ads cited on error: 317 procedure Set_Field 318 (Val : JSON_Value; 319 Field_Name : UTF8_String; 320 Field : Integer) 321 with Pre =3D> Val.Kind =3D JSON_Object_Type; 322 323 procedure Set_Field 324 (Val : JSON_Value; 325 Field_Name : UTF8_String; 326 Field : Long_Integer) 327 with Pre =3D> Val.Kind =3D JSON_Object_Type; If I changed 1992 to "1992" on line 16, and 1986 to "1986" on line 30, the = program compile ok. Why compile didn't resolve correctly, as stated here [2]? Thanks [1] https://rosettacode.org/wiki/JSON#Ada [2] https://learn.adacore.com/books/Ada_For_The_CPP_Java_Developer/chapters= /06_Functions_and_Procedures.html?#overloading -- Ricardo Brand=C3=A3o