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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7b5615402713dcbb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.73.228 with SMTP id o4mr2520904pav.32.1346120080086; Mon, 27 Aug 2012 19:14:40 -0700 (PDT) Received: by 10.68.135.103 with SMTP id pr7mr1156819pbb.7.1346120080067; Mon, 27 Aug 2012 19:14:40 -0700 (PDT) Path: a8ni39172319pbd.1!nntp.google.com!q4no7657417pbi.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 27 Aug 2012 19:14:39 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 References: <8bfbf709-18ac-43cd-b037-ce47adde96c2@googlegroups.com> <1dy5xgqtdqpp6$.qio4t8fjk8b5.dlg@40tude.net> <513d6efb-6aad-4013-8b21-37c75aa6aaf7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada and Java/C++ From: Adam Beneschan Injection-Date: Tue, 28 Aug 2012 02:14:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-08-27T19:14:39-07:00 List-Id: 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