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.182.104.68 with SMTP id gc4mr5306083obb.40.1405262035108; Sun, 13 Jul 2014 07:33:55 -0700 (PDT) X-Received: by 10.182.250.195 with SMTP id ze3mr1659obc.34.1405262034994; Sun, 13 Jul 2014 07:33:54 -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!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h18no967548igc.0!news-out.google.com!bp9ni9igb.0!nntp.google.com!h18no316025igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 13 Jul 2014 07:33:54 -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: 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:33:55 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:20911 Date: 2014-07-13T07:33:54-07:00 List-Id: On Sunday, July 13, 2014 1:26:16 AM UTC-5, Jeffrey Carter wrote: > On 07/12/2014 06:55 PM, Nasser M. Abbasi wrote: > > Just wondering on this choice and its advantage over the more > > common syntax. It is not that uncommon. See C++'s exact equivalent below. > 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. C++ has conversion constructors that have exactly the same syntax as Ada's = type conversion. C++ borrowed the idea & syntax from Ada. (Yes, C++ has d= ynamic_cast, static_cast, and reinterpret_cast as well as the obsolescent c= ast from C, but that is in situ type casting, not type conversion from one = type of instance to another type of freshly-synthesized instance.) In mode= rn C++, conversion constructors come in 2 varieties: implicit (i.e., the e= arly-C++ variety) and explicit when annotated at time of declaration with t= he explicit keyword. 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: 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. [Why did Algol68 utilize mode as= the term for type? Think modus operandi.] Algol68 utilized the exact sam= e syntax for explicit mode conversions as Ada borrowed for type conversions= and that C++ borrowed (from either Algol68 or Ada or both as early C++'s m= antra was "Ada done right") for conversion constructors. Algol68 had multi= ple strengths of implicit (soft, weak, meek, firm, and strong) mode coercio= n. (I could be incorrect that all of soft, weak, meek, firm, and strong ar= e always implicit.)