comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: why Ada type casting is different from other languages? newType(value) vs. (newType)value
Date: Mon, 14 Jul 2014 13:51:08 -0700 (PDT)
Date: 2014-07-14T13:51:08-07:00	[thread overview]
Message-ID: <1a99190f-019f-4379-90e6-6ec58bf4be2a@googlegroups.com> (raw)
In-Reply-To: <lq1bq1$o5d$1@dont-email.me>

On Monday, July 14, 2014 2:41:58 PM UTC-5, Simon Clubley wrote:
> On 2014-07-14, G.B. <> wrote:
> >     f(C(p).A(I))(N)
> > "might be better conveyed with the syntax:
> >     f(C::p->A_{I})[N]
> 
> To be honest, that suggestion by the authors sounds a bit bogus to me.
> 
> By the time a newcomer is far enough along to understand the concepts
> behind that syntax, does that person really still need that special
> syntax ?

Let's face it.  Far less than 1% of programmers work for an employer or on an open-source project that builds out an ASIS-based (for Ada) or Clang-based (for C or C++ or Objective-C) or GCC MELT-based (for C or C++) source-code analysis tool with a precise & accurate parser.  (In fact, I suspect that the true number is far less than 1/100th of 1%.)  Without such a precise & accurate parser, grep(3)ing through source code to find that cryptic type-case or type-conversion is likely to give numerous false negatives (as well as false positives).  Ignoring obfuscation possible in the C preprocessor, grep(3)ing through source code for type-casting syntax that is designed to be extraordinarily obvious (e.g., C++'s static_cast<type>(expression), dynamic_cast<type>(expression), and reinterpret_cast<type>(expression) is a highly-desirable welcome alternative to building out a ASIS-based or Clang-based or GCC MELT-based source-code analyzer/parser tool.  That goes for the expert in the language and it goes double (or a decimal order of magnitude more) for a beginner in a language.

As I mentioned earlier in a branch of this thread, Ada's subtle typecasting syntax is a historical artifact of mimicking ALGOL68's type-cast syntax back when Green was designed in the 1970s back when ALGOL68 still had some sway as the state-of-the-art in language-design.

> The above is not what you would teach a student new to programming
> in their first week of class.

  But that is sort of the point, now isn't it.  In a strongly-typed language, every way of manipulating types is a core part of the essential language.  When a programmer (beginning or otherwise) needs to play parser on typing information (which most programmers consider playing language lawyer, which is disdain not a complement), then most Millennial-generation programmers just give up and go with a less-strongly-type scripted language and declare a sort of victory.

  reply	other threads:[~2014-07-14 20:51 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
2014-07-14 19:41     ` Simon Clubley
2014-07-14 20:51       ` Dan'l Miller [this message]
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