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 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!news.stack.nl!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: why Ada type casting is different from other languages? newType(value) vs. (newType)value Date: Mon, 14 Jul 2014 18:41:00 +0100 Organization: A noiseless patient Spider Message-ID: References: <53c40435$0$6612$9b4e6d93@newsspool4.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="5cbec41b82bafb9ba55107f02585e18b"; logging-data="30214"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sdHxq8yVUA27Qsa+PqwUu4xw+G8gJFPI=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:UfZ+BfF2KvqU4wT/ciFcaulbA64= sha1:Neyp4IZdeV+yWbLLYsesUekR4qc= Xref: number.nntp.dca.giganews.com comp.lang.ada:187583 Date: 2014-07-14T18:41:00+01:00 List-Id: "G.B." writes: > "Alternatively, it may be better to increase the complex- > ity of the syntax in order to reduce homonyms which blur > the signal. For example, the meaning of the various compo- > nents of the Turing expression^7: > > > f(C(p).A(I))(N) > > "might be better conveyed with the syntax: > > f(C::p->A_{I})[N] > > "The second form, whilst regrettably no more mnemonic than > the first, does at least provide adequate visual differen- > tiation between pointer dereference, array indexing, func- > tion call, and substring extraction. > > ^7: > "Create a substring consisting of the Nth letter of > the string returned by the function f when passed > the Ith element of the array member A of the object > within collection C which is pointed to by p". > > Linda McIver & Damian Conway, > Seven Deadly Sins of Introductory Programming Language Design Cripes. The first (Ada-ish) version makes sense to me, the second -- ugh. Actually, the Ada version might be f(p.A(I))(N) depending on what "the object within collection C which is pointed to by p" means.