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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.161.8 with SMTP id v8mr4655349yhk.0.1405262537006; Sun, 13 Jul 2014 07:42:17 -0700 (PDT) X-Received: by 10.182.28.71 with SMTP id z7mr17023obg.16.1405262536896; Sun, 13 Jul 2014 07:42:16 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!v10no221028qac.1!news-out.google.com!bp9ni9igb.0!nntp.google.com!h18no317704igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 13 Jul 2014 07:42:16 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.252.147.203; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 71.252.147.203 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <69d75ff9-18f1-4ecf-bcb1-02a625a492e7@googlegroups.com> Subject: Re: why Ada type casting is different from other languages? newType(value) vs. (newType)value From: "Dan'l Miller" Injection-Date: Sun, 13 Jul 2014 14:42:16 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3453 X-Received-Body-CRC: 236716482 Xref: news.eternal-september.org comp.lang.ada:20912 Date: 2014-07-13T07:42:16-07:00 List-Id: On Sunday, July 13, 2014 1:26:16 AM UTC-5, Jeffrey Carter wrote:=20 > On 07/12/2014 06:55 PM, Nasser M. Abbasi wrote:=20 > > Just wondering on this choice and its advantage over the more=20 > > common syntax.=20 It is not that uncommon. See C++'s exact equivalent below.=20 > For the same reason Ada has type conversions, not type casts. "Type conve= rsion"=20 > is clear; "type cast" must be explained if you haven't encountered it bef= ore.=20 > Ada's notation is clear; conversions involve some processing and so are l= ike=20 > functions. C's unintuitive notation must be explained when 1st encountere= d.=20 C++ has conversion operators [i.e., operator destinationType(const originTy= pe&) without any type occupying the customary return-type slot] that have e= xactly the same syntax as Ada's type conversion. C++ borrowed the idea & s= yntax from Ada. (Yes, C++ has dynamic_cast, static_cast, and reinterpret_c= ast as well as the obsolescent cast from C, but that is in situ type castin= g, not type conversion from one type of instance to another type of freshly= -synthesized instance.) In modern C++, conversion operators come in 2 vari= eties: implicit (i.e., the early-C++ variety) and explicit when annotated = at time of declaration with the explicit keyword.=20 Here is what I believe to be the most historically-correct answer to your q= uestion, but only the early Green team, especially Ichbiah) would know for = sure:=20 Ada was probably influenced by Algol68's mode coercion, where mode is Algol= 68-speak for type and coercion is Algol68-speak for conversion or casting o= r dereferencing or bit-widening numerics among its 7 categories of mode coe= rcion. [Why did Algol68 utilize mode as the term for type? Think modus op= erandi: the mode of operation of that bit-string.] Algol68 utilized the e= xact same syntax for explicit mode conversions as Ada borrowed for type con= versions and that C++ borrowed (from either Algol68 or Ada or both as early= C++'s mantra was "Ada done right") for conversion operators. Algol68 had = multiple strengths of implicit (soft, weak, meek, firm, and strong) mode co= ercion. (I could be incorrect that all of soft, weak, meek, firm, and stro= ng are always implicit.)