comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: newbie can't get exceptions to work!
Date: Tue, 10 Apr 2001 01:26:50 GMT
Date: 2001-04-10T01:26:50+00:00	[thread overview]
Message-ID: <wccbsq55yud.fsf@world.std.com> (raw)
In-Reply-To: Pine.BSF.4.21.0104061524390.5067-100000@shell5.ba.best.com

Brian Rogoff <bpr@shell5.ba.best.com> writes:

> OK, I was sort of being a pain with that question. However, since we're 
> redesigning the language :-), the right solution IMO would be to have a 
> more precise form of import and export clause than what Ada has, so that 
> if you want to use a package you can choose precisely what gets seen.
> This way, the use type folks are happy, I'm happy (well, I'm always happy:)
> you're happy (yes?),

Me?  Happy?  I'll be happy when I've designed the perfect programming
language (or somebody else beats me to it).  I.e., never.  ;-)

>... and Niklaus Wirth is vindicated. For example,
> something like 
> 
> from Some_Package use "+", "-", "*", Some_Function;
> 
> ...
> Some_Package.Some_Other_Function(Some_Function(A + B * C));

I think this idea has some merit, but I tend to think that most of the
decisions should be on the other end.  That is, the person who chose the
names for Some_Function and Some_Other_Function is in a better position
to choose whether they should be used with "Some_Package." notation.

But for operators, I still insist that they should *never* be used with
dot notation, so if they're used at all, operator notation should be
used.  (Mike Yoder posted an obscure counter-example to my "never"
claim, some months ago.  Still...)

> > I agree that it's an annoying restriction.  The reason, I guess, is that
> > if you allowed someone to define an operator "$" or "&^%$$##", you would
> > have to worry about the syntax.  What is the precedence of these
> > operators?  I think Cecil has a nice solution to the problem.
> 
> What's the Cecil solution?

The problem with most languages that allow (more-or-less) arbitrary
operator symbols is that they view precedence as a relationship between
any pair of operators.  You get to define the precedence "level" of, say
$*&(^, and then it relates to the normal + and so forth as specified.
But that's error prone.

The cool thing about Cecil is that you define precedence among related
operators.  If two operators are unrelated, you have to parenthesize.
This seems much less error prone to me.

>... The OCaml solution is to have precedence and
> associativity inherited from the first character of the operator, so 
> +. and +/ are like +.

Sounds error prone.  If +/ is unrelated to +, then

    X +/ Y + Z

should require parentheses.

>... Unfortunately OCaml doesn't yet have overloading so 
> it really needs this feature. You're probably not surprised to learn that 
> in many language communities (Modula-3, ML, Eiffel?) overloading is viewed 
> by many the same way that "use" is viewed by many in the Ada world. And I 
> respond the same way, sure overloading can make a mess for the reader but 
> used well it makes code more readable.

Agreed.  It's hard to get too hot and bothered about the dangers of
overloading, which is resolved at compile time, in a language like
Eiffel (or Ada), where a given name is dispatched at *run* time.
Yes, it's potentially confusing, but it's also potentially good.

> I tell you what, design this next language, and I'm on board. I'm willing
> to give up full closures as long as pattern matching and parametric
> polymorphism are in the language.

Please explain to me why pattern matching is so wonderful.  I know about
ML and the like, and pattern matching seems kind of nice, but why do ML
advocates seem to think it's so much more than just "nice".  Why is it
so much more wonderful than an 'if' statement?

And is your answer specific to OCaml, or does it apply equally to ML?

 Take a look at the Cyclone project as 
> an example of a decent looking futuristic systems programming language, 
> unfortunately based on C. 
> 
> http://cvs.metaprl.org:12000/cvsweb/~checkout~/cyclone/doc/cyc_users_guide.htm
> 
> > > > why should you have to write "use" in order to write
> > > > "if X = Y ..."?
> > > 
> > > "=" is also kind of special, right? 
> > 
> > Unfortunately true.
> 
> This is actually a deep problem.

Indeed.  I don't know the right answer.

>... SML has it's eqtypes, OCaml has it's
> polymorphic comparison primitives. Neither seem satisfactory to me. 
> 
> > I meant that all operators should be exempt.  I wasn't speaking
> > particularly about ":=" and "=" (and I realize that Ada defines "=" to
> > be an operator, but not ":=" or "in", etc).
> 
> Well, I think the Wirthian solution is probably better, and has the nice 
> property of not treating operators specially. 

I don't think that treating operators non-specially is a good thing.
Sure, it seems elegant (more uniform), but in practise, surely you want
operators to be visible with no fuss or bother.  Operator symbols *are*
special, because the programmer chose to use concise syntax over
wordiness ("*" vs "Multiply", for example).

Does it bother you that if we have:

    X: Some_Package.Some_Type;
    Y: Some_Package.Some_Type;

you can say (in Ada):

    X := Y;

Or would you prefer to require (the Wirthian?):

    from Some_Package import ":=";

first?

>...Why didn't Ada have such a
> selective import? 

I don't know the history of that.

- Bob



  parent reply	other threads:[~2001-04-10  1:26 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
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 [this message]
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