comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
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
Date: 2014-07-14T18:41:00+01:00	[thread overview]
Message-ID: <ly1ttnyh1v.fsf@pushface.org> (raw)
In-Reply-To: 53c40435$0$6612$9b4e6d93@newsspool4.arcor-online.net

"G.B." <rm-dash-bau-haus@dash.futureapps.de> 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.


  reply	other threads:[~2014-07-14 17:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-13  1:55 why Ada type casting is different from other languages? newType(value) vs. (newType)value Nasser M. Abbasi
2014-07-13  3:01 ` Shark8
2014-07-13  6:26 ` Jeffrey Carter
2014-07-13 14:33   ` Dan'l Miller
2014-07-13  9:01 ` Niklas Holsti
2014-07-13  9:08   ` Dmitry A. Kazakov
2014-07-13 10:20     ` AdaMagica
2014-07-13 10:24     ` Georg Bauhaus
2014-07-14 23:36       ` Randy Brukardt
2014-07-15 18:42         ` G.B.
2014-07-15 19:14           ` Niklas Holsti
2014-07-15 22:47             ` Georg Bauhaus
2014-07-15 19:19           ` Jeffrey Carter
2014-07-15 23:07             ` Georg Bauhaus
2014-07-15 22:00           ` Randy Brukardt
2014-07-13 14:42 ` Dan'l Miller
2014-07-14 15:25 ` Adam Beneschan
2014-07-14 16:24   ` G.B.
2014-07-14 17:41     ` Simon Wright [this message]
2014-07-14 19:41     ` Simon Clubley
2014-07-14 20:51       ` Dan'l Miller
2014-07-14 23:23       ` Randy Brukardt
2014-07-15 19:22 ` Marius Amado-Alves
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox