comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: newbie can't get exceptions to work!
Date: Tue, 10 Apr 2001 19:44:48 GMT
Date: 2001-04-10T19:44:48+00:00	[thread overview]
Message-ID: <Pine.BSF.4.21.0104101226080.6047-100000@shell5.ba.best.com> (raw)
In-Reply-To: <86wv8sfwec.fsf@acm.org>

On 10 Apr 2001, Laurent Guerby wrote:
> Brian Rogoff <bpr@shell5.ba.best.com> writes:
> > On 9 Apr 2001, Laurent Guerby wrote:
> > > broken case statements,
> > 
> > Broken semantically. Using the name switch wouldn't make a difference. 
> > Besides, I much prefer ML or Haskell pattern matching to Ada's case 
> > statement. More readable, more powerful, terser, better. 
> 
> Well, that's no longer syntax ;-). The horror I was refering too was
> the optional break as you might have guessed. Also I find the
> mandatory enumerate all rule in alternatives of Ada is quite useful.

Oh yes. For all of those who complain about Microsoft, I just checked and 
they did *not* carry on this abomination in C#. This is a big issue IMO, 
and a real source of bugs in my experience with C. So MS language
designers are far bettre than Sun's. :-)
> 
> I agree that pattern matching is something very nice to have anyway.
> 
> > > named and order free arguments and agregates, 
> > 
> > Would be nice. There is some discussion about adding this to Ocaml now
> > too. You can use labelled params, but commuting arguments are still up in
> > the air. 
> 
> I must admit I don't understand why every language doesn't have this
> feature, especially all those conceived after Ada like OCaml. 

Well, I'm doing what I can on the OCaml mailing list to get nice little
features of Ada adopted. In the case of labeled and optional arguments,
it's a lot tougher in OCaml than Ada, which has type inference and higher
order functions. If you look at the recent discussions on the mailing
list, Jacques Garrigue (the label inventor and main proponent) is laying
out the alternatives and it looks like the only way to get commuting
labels is to have labels be non-optional. I don't like that. 
  
> suspect we should mandate Ada history and design rationale lectures to
> all language creators, a lot of engineering went into Ada, and we've
> had a lot of time to judge the work done.

Yes, I completely agree. And, for the record, I prefer begin-end to {} :-).
I would just like to point out that it isn't an earth shattering change,
and the reasons I much prefer Ada have little to do with it's surface
syntax, and much more to do with it's mostly non-surprising semantics.

> My favourite citation here is from Steve McConnell in "code Complete":
> 
>    Finally, the goto was incorporated into the Ada language, the
>    most carefully engineered programming language in history.

Actually, if Ada had downward funargs and maybe lighweight anonymous
functions, it would be pretty easy to write the state machine example 
in continuation passing style and that would be just as readable as 
using goto's. Please, no flames, I find using gotos for FSMs to be much
much nicer than using extra vars and case statements. 

> > > and operator character choice, 
> > 
> > True, but I must say that the += and friends are nice. Of course an Ada
> > version would be +:= and still nice. 
> 
> That's a possibility. Another is to have a way to generate tersely
> procedural versions of operators, may be (ok ugly ;-)
> 
> procedure Inc is procedural "+";
> -- Inc (X : in out T; Y : in T) is begin X := X + Y; end Inc;
> 
> Not really functional BTW ;-).

That's OK, as an ML fan I'm really only "mostly functional". Haskell,
Clean, and Mercury fans spit at me when I walk by. No need to describe
what they do to Ada or C++ fans ;-). 


> > And while I don't like the syntax, the ? : of C is also nice, but,
> > as you know, I'm a functional kind of guy now.
> 
> This is not just syntax here, Ada doesn't have a way to do the same as
> C here because of strictness in argument evaluation. I recently
> designed a small language with an Ada-style syntax and I added "if"
> expressions :
> 
> X : constant T := if C1  then V1 elsif C2 then V2 else V3;
> 
> This is something I think people miss in Ada, may be someone should
> wrote an extension proposal ;-).

That would work. OTOH, since Ada is statement oriented rather than
expression oriented, perhaps a different syntax for conditional
expressions is warranted?

> > > And I would absolute religious belief in keeping those
> > > historical mistakes around (see Java).
> > 
> > I can't parse that. Let me guess, "And I would add, an absolute ..."?
> 
> You have a powerful syntax recovery parser in your brain ;-).

Influenced by GNAT, as you must know ;-).

> > > If {} vs begin/end is issue for a new language, allow both and end of
> > > the story.
> > 
> > That would be a mistake. Personally, I can go either way, begin-end or {}. 
> > I'm just annoyed at the bizarre thinking that puts one of these as greatly 
> > superior to the other. I really find () to be a bummer about Ada syntax
> > and I don't agree that wordier is always better. 
> 
> As other people pointed out, another advantage of end syntax is the
> "end thing" which is quite nice. I think that if you allow declarations
> to float around, the argument about terseness of {} becomes moot, eg:
> 
> procedure P is
>    variable X : T := Initial;
>    while Cond (X) loop  
>       constant Tmp : T := G (X);
>       if Cond (Tmp) then
>          Do_Thing (Tmp, X);
>       end if;
>       Next (X);
>    end loop;
> end P;
> 
> would not gain much from {}.

Allowing declarations to float is nice. However, if, as I suggested, we
allow downward funargs (only downward, we don't want to require GC :) 
and anonymous functions, the {} has the advantage that function
definitions are lightweight enough to be expressed inline more easily. 

Even in ML, I don't use anonymous functions too much though, since there
is usually just enough work to be done by a function that it can't be
expressed easily in one line. I maintain a piece of code where someone
wrote an anonymous function over 100 lines long. Mama mia! 

> And I of course forgot the mandatory () for function calls without 
> args silliness ;-).

A great feature. Some people hate it though. 

> > > PS: also, on a french keyboard, {} [] are a major pain to type ;-).
> > 
> > Hey man, get an American keyboard!
> 
> No, I just program in Ada at home and work ;-) ;-).

Lucky you! I've switched to OCaml. Something about French designed
languages, eh? :-)

-- Brian





  reply	other threads:[~2001-04-10 19:44 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-05  3:19 newbie can't get exceptions to work! Jeff Shipman
2001-04-05  4:25 ` Ed Falis
2001-04-05 11:00   ` martin.m.dowie
2001-04-05 14:21     ` Ted Dennison
2001-04-05 17:50       ` Fraser Wilson
2001-04-05  4:34 ` Jeff Shipman
2001-04-05  4:59 ` Wilhelm Spickermann
2001-04-05 14:14   ` Ted Dennison
2001-04-05 16:37     ` Wilhelm Spickermann
2001-04-06 13:09     ` Marc A. Criley
2001-04-06 15:04       ` Ted Dennison
2001-04-06 16:43       ` Robert A Duff
2001-04-06 17:39         ` Ted Dennison
2001-04-06 21:50           ` Robert A Duff
2001-04-06 20:11         ` Brian Rogoff
2001-04-06 22:20           ` Robert A Duff
2001-04-06 23:04             ` Brian Rogoff
2001-04-07  5:48               ` Jeffrey Carter
2001-04-10  1:29                 ` Robert A Duff
2001-04-07 19:30               ` Robert A Duff
2001-04-07 21:17                 ` Brian Rogoff
2001-04-07 21:25                   ` Ayende Rahien
2001-04-07 22:57                     ` David Starner
2001-04-08 12:10                       ` Ayende Rahien
2001-04-08  2:12                     ` Larry Hazel
2001-04-08 12:12                       ` Ayende Rahien
2001-04-09 16:20                         ` Larry Hazel
2001-04-10  2:38                           ` Ayende Rahien
2001-04-10  3:25                             ` James Rogers
2001-04-08 22:18                       ` Brian Rogoff
2001-04-09 15:14                         ` Ted Dennison
2001-04-09 17:23                           ` Brian Rogoff
2001-04-09 18:23                             ` Laurent Guerby
2001-04-09 19:15                               ` Brian Rogoff
2001-04-10 18:21                                 ` Laurent Guerby
2001-04-10 19:44                                   ` Brian Rogoff [this message]
2001-04-11 18:03                                     ` Laurent Guerby
2001-04-11 18:33                                       ` Samuel T. Harris
2001-04-14  0:06                                         ` Robert A Duff
2001-04-12  1:42                                       ` Mike Silva
2001-04-12  2:38                                       ` Brian Rogoff
2001-04-12 23:23                                         ` Laurent Guerby
2001-04-13  2:44                                           ` Brian Rogoff
2001-04-11 13:24                                   ` Ayende Rahien
2001-04-11 13:14                                     ` Mats Karlssohn
2001-04-11 15:08                                       ` Ayende Rahien
2001-04-11 21:42                                       ` Fraser Wilson
2001-04-12 23:55                                         ` Robert A Duff
2001-04-10  2:12                               ` Robert A Duff
2001-04-10  3:47                                 ` Brian Rogoff
2001-04-10 13:40                                 ` Ada keywords (was: Re: newbie can't get exceptions to work!) Marin David Condic
2001-04-10 14:26                                   ` Jean-Pierre Rosen
2001-04-09 20:49                             ` newbie can't get exceptions to work! Ted Dennison
2001-04-09 21:44                               ` Brian Rogoff
2001-04-09 21:59                                 ` Ted Dennison
2001-04-10  2:54                                   ` Ayende Rahien
2001-04-10 14:00                                     ` Ted Dennison
2001-04-10 17:44                                     ` Fraser Wilson
2001-04-10  6:59                               ` Mats Karlssohn
2001-04-10 14:18                                 ` Ted Dennison
2001-04-10 16:27                                   ` Mark Biggar
2001-04-11 11:55                                     ` Mats Karlssohn
2001-04-11 14:34                                       ` Samuel T. Harris
2001-04-11 15:50                                         ` Pat Rogers
2001-04-12  6:27                                         ` Mats Karlssohn
2001-04-11 11:49                                   ` Mats Karlssohn
2001-04-11 15:38                                     ` Robert A Duff
2001-04-13 16:12                             ` Matthew Woodcraft
2001-04-10  1:41                   ` Robert A Duff
2001-04-10  3:03                     ` James Rogers
2001-04-10  3:58                       ` Brian Rogoff
2001-04-10 21:48                         ` Ted Dennison
2001-04-11 15:09                           ` Ayende Rahien
2001-04-11 21:57                             ` James Rogers
2001-04-11 23:13                               ` Brian Rogoff
2001-04-12  6:33                                 ` Mats Karlssohn
2001-04-12 16:38                                   ` Brian Rogoff
2001-04-17  7:04                                     ` Mats Karlssohn
2001-04-17  9:08                                       ` Jean-Pierre Rosen
2001-04-12 15:16                               ` Ted Dennison
2001-04-12 21:22                                 ` James Rogers
2001-04-10  4:26                     ` Brian Rogoff
2001-04-11 15:30                       ` Robert A Duff
2001-04-11 17:33                         ` Brian Rogoff
2001-04-10  1:26               ` Robert A Duff
2001-04-10  2:11                 ` Brian Rogoff
2001-04-14  0:00                   ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
2001-04-05  5:26 Christoph Grein
replies disabled

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