comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Ada and Java/C++
Date: Mon, 27 Aug 2012 19:14:39 -0700 (PDT)
Date: 2012-08-27T19:14:39-07:00	[thread overview]
Message-ID: <b5ae2953-1c55-4768-add4-75af019c0e98@googlegroups.com> (raw)
In-Reply-To: <k1gv4k$52m$1@munin.nbi.dk>

On Monday, August 27, 2012 4:16:39 PM UTC-7, Randy Brukardt wrote:

> I agree with you here (but also see below). But the syntax of a language is
> a very important part of the foundation of the language. Ada's syntax is
> designed to minimize the possibility for inadvertant errors, which is not
> the case with the C syntax. (See, for instance, the discussion in Rationale
> 2012 about this:
> http://www.ada-auth.org/standards/12rat/html/Rat12-3-2.html.)

Hmmm ... I guess it depends on just how much of the syntax the OP
is thinking of keeping.  I'd think that if we're just talking about
the "look and feel", one could probably develop a language that has
the functionality of Ada but using C-like keywords and operators,
without compromising safety.  I'm not saying it's a good idea.
Personally, if someone sent me a compiler for a language like that, I
wouldn't just delete it from my system, I'd print it out just so that
I could run it through a shredder and then stomp on it.

But some changes, like using [] instead of () for array indices or { }
instead of begin/end or expressing type conversions as
(type)expression instead of type(expression), wouldn't seem to have
any negative impacts on safety.  (Just on aesthetics.)  In other
cases, some of the unsafe syntax in C has been made safer or just
prohibited in languages like Java.  For example, Java doesn't allow a
lot of the type casts that you can get yourself into trouble with in
C; I don't believe it supports the unary * or & operators at all; and
while I think that in C programmers can and do run into problems using
binary & when they mean && or vice versa, Java eliminated this by
adding a real boolean type, and then decreeing that && could only be
used on booleans and & only on integers.

The point is that if the OP's premise is correct--that Java is popular
because it borrows from C syntax even though it eliminated some of the
unsafe and error-prone things from the language, then in theory, a
mutant Ada language with C-like syntax could do the same.  If I were
induced by a very large sum of money to help develop such a language,
I'd want to make some changes like (1) making assignment statements
statements rather than expressions, so that even if = is used as the
assignment operator instead of := you still can't mess yourself up by
using = in the middle of an expression when you're trying to compare
two things for equality, (2) not allowing functions with non-void
function results to appear as statements, without assigning the
result; (3) adding some sort of null statements that would have to be
used instead of "nothingness" to prevent goofups like

   for (i = 0; i < max; i++) ;
      sum += a[i];

(4) preventing fall-through in switch statements.  All of these would
help accomplish preventing errors and unsafe code.  I'd want to do
something about auto-increment and decrement and the dangling else
problem, too, which are other sources of errors.  But it's possible,
at least in theory, that some C programmers would still find this
appealing, and wouldn't miss the features too much that we yank out.
Or maybe they *would* miss them too much.  I don't know.  And I
personally don't think it's worth devoting any more thought to, so I'm
going to stop here.


> Here I strongly disagree. The above might be true for natural languages, but
> for programming languages, you want the syntax of the various ones you use
> to be as different as possible. Speaking from my own experience, when
> Janus/Ada was originally constructed in Pascal, the subtle differences
> between the two languages (both in syntax and semantics) used to drive us
> nutty.

That's a problem for natural languages, too.  Spanish and Italian are
similar in a lot of ways, and I've heard that back when Fernando
Valenzuela started pitching for the Dodgers, when Tom Lasorda would
occasionally interpret for him during post-game interviews, he mixed
Italian in with his Spanish.  I've heard similar things from others
who were fluent in Spanish and were trying to learn Italian.  But I
suppose this problem isn't a huge one in human speech--I don't think
Fernando ever stopped the interview to say "syntax error" when Lasorda
used the wrong word.  :)

                            -- Adam



  reply	other threads:[~2012-08-28  2:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27 10:46 Ada and Java/C++ kalvin.news
2012-08-27 11:48 ` Dmitry A. Kazakov
2012-08-27 13:44   ` kalvin.news
2012-08-27 14:33     ` Dmitry A. Kazakov
2012-08-27 15:26     ` J-P. Rosen
2012-08-27 15:46       ` Georg Bauhaus
2012-08-27 16:08       ` kalvin.news
2012-08-27 23:16     ` Randy Brukardt
2012-08-28  2:14       ` Adam Beneschan [this message]
2012-08-28 10:50         ` Brian Drummond
2012-08-28 14:22           ` kalvin.news
     [not found]           ` <gcup38ldi4afrt9q2uj70qoe7l2lcn4rk1@invalid.netcom.com>
2012-08-28 23:00             ` Brian Drummond
     [not found]               ` <fouq38tqdp7fh86l2dp2pmr8jfdgi24i7j@invalid.netcom.com>
2012-08-29 10:39                 ` Brian Drummond
2012-08-27 14:35   ` Nomen Nescio
2012-08-27 21:23     ` gautier_niouzes
2012-08-27 14:09 ` Niklas Holsti
     [not found] ` <al1n38tdd0tq6p1os6p6angt91mginhoup@invalid.netcom.com>
2012-08-27 14:49   ` kalvin.news
2012-08-27 14:53   ` kalvin.news
2012-08-27 19:46     ` Shark8
2012-08-27 20:11     ` gautier_niouzes
2012-08-27 19:41 ` Shark8
2012-08-27 20:06 ` gautier_niouzes
2012-08-28  5:35 ` kalvin.news
2012-08-28  6:57   ` Shark8
2012-08-28  8:28     ` kalvin.news
2012-08-28 10:00       ` Niklas Holsti
2012-08-28  8:31     ` kalvin.news
2012-08-28  9:15       ` Niklas Holsti
2012-08-28  9:54   ` gautier_niouzes
2012-08-28 14:08     ` kalvin.news
2012-08-29 10:52 ` kalvin.news
replies disabled

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