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: a07f3367d7,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!d9g2000prh.googlegroups.com!not-for-mail From: jimmaureenrogers@worldnet.att.net Newsgroups: comp.lang.eiffel,comp.lang.ada Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Sat, 25 Jul 2009 07:32:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <01bf2266-bac8-4cdf-908d-09e532481512@d9g2000prh.googlegroups.com> References: <24b1e02c-ef00-4adf-be11-e65277fc095c@j32g2000yqh.googlegroups.com> NNTP-Posting-Host: 75.70.240.233 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1248532339 11067 127.0.0.1 (25 Jul 2009 14:32:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 25 Jul 2009 14:32:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d9g2000prh.googlegroups.com; posting-host=75.70.240.233; posting-account=fZH-XgkAAADP-Rf8L8ppyFIdKUfh90k4 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729) AutoPager/0.5.2.2 (http://www.teesoft.info/),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.eiffel:423 comp.lang.ada:7340 Date: 2009-07-25T07:32:19-07:00 List-Id: On Jul 24, 3:46=A0pm, Robert A Duff wrote: > I didn't look up the above quote from Meyer, but assuming he wrote that, > he was mistaken. =A0Ada DOES use result types to help resolve overloading= . > This was true in Ada 83, and it's still true the latest version > (Ada 2005). A modest example follows: with Ada.Text_Io; use Ada.Text_Io; with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; procedure Overload_On_Return_Example is function Sqrt(Item : in Float) return Integer is Result : Integer; begin Result :=3D Integer(Float'Rounding(Sqrt(Item))); return Result; end Sqrt; Base_Value : Float :=3D 221.0; begin Put_Line("Floating point square root of" & Float'Image(Base_Value) & " is" & Float'Image(Sqrt(Base_Value))); Put_Line("Integer square root of" & Float'Image(Base_Value) & " is" & Integer'Image(Sqrt(Base_Value))); end Overload_On_return_Example; Note that the function Sqrt defined in the example above takes a floating point argument and returns an integer which is created from rounding the result of the Sqrt function returning a floating point number. The output of this program is: Floating point square root of 2.21000E+02 is 1.48661E+01 Integer square root of 2.21000E+02 is 15 Clearly, the compiler had to distinguish between the overloaded Sqrt functions by return type. Jim Rogers