comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: The Red Language
Date: 1997/09/20
Date: 1997-09-20T00:00:00+00:00	[thread overview]
Message-ID: <dewar.874757740@merv> (raw)
In-Reply-To: EGpw57.8BI@world.std.com


Bob Duff said (I'm really really sure it was him :-)

<<It's true that all kinds of special situations are a pain, but I still
claim that the 2-pass algorithm required by Ada is more complicated than
the 1-pass algorithm of C++ and Red.  The 2-pass algorithm requires
*sets* of types to be passed up the tree, whereas in the 1-pass
algorithm you can pass a single type up the tree.

Yeah, I agree that's not such a big deal, and I certainly think the Ada
way is Good.>>


Right, it's not such a big deal, and Bob Duff's suggestion that the
concern for difficulty of compilation is what might motivate the choice
between the bottom-up overloading (first introduced in Algol-68) and the
both-ways overloading (first introduced in Ada 83) does not match the
history.

As almost always these days, the simplicity/complexity decisions are much
more focussed on users than on the implementor, especially in a case like
this where the implementation decisions are clear.

Certainly the designers of Algol-68 deliberately did NOT introduce the
both-way scheme, and this decision had nothing at all to do with concern
for ease of implementation (after all in Algol-68, just telling whether
two variables are the same type requires a sufficiently complex algorithm
that more than one PhD thesis has been written on the topic!)

The concern is for simplicity from a users point of view. We have had this
long discussion in the (rather tedious) Eiffel-vs-Ada thread about the
desirability of linear elaboration, and this issue is related. If you have
a really complex expression and you want to figure out what is being calld
where, then clearly the one-pass scheme is easier for a human to figure out.

The question is whether this simplicitly is gained at the expense of loss
of expressive power.

There is no question that there are cases where the Ada scheme is
a great advantage:

  generic
    type Element_Type is private
  package Set_Package is
    functoin Empty_Set return Element_Type;
    function Value (A : String) return Element_Type;
    ...

It is really useful to be able to instantiation Set_Package for various
different types, apply a use clause to the insantiations, and have the
compiler figure out which Empty_Set and Value functions you want.

The time that the two-pass scheme begins to cause trouble is in mixed
operations. For example, one might think it was useful to have all the
following in Unbounded_String:

(where UString is short for Unbounded_String)

function "&" (A : String;  B : String) return Unbounded_String;
function "&" (A : UString; B : String) return Unbounded_String;
function "&" (A : String;  B : UString) return Unbounded_String;
function "&" (A : UString; B : UString) return Unbounded_String;

But it is a mistake, because now

   Ustring := "abcc" & Stringvar & Ustring;

is annoyingly ambiguous. It is quite easy to trip up on this problem if
you are not careful in designing such sets of mixed operations.






  reply	other threads:[~1997-09-20  0:00 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <340E2DC5.25D7@worldnet.att.net>
     [not found] ` <340ebdaf.230366903@news.mindspring.com>
     [not found]   ` <340ED5D8.2DEF6D3@ux4.sp.cs.cmu.edu>
1997-09-04  0:00     ` The Red Language Robert Munck
1997-09-07  0:00       ` Robert Dewar
1997-09-08  0:00         ` Richard Kenner
1997-09-12  0:00           ` David Wheeler
1997-09-12  0:00             ` Robert A Duff
     [not found]     ` <199709051335.PAA25952@basement.replay.com>
1997-09-05  0:00       ` Dean F. Sutherland
1997-09-08  0:00         ` Robert A Duff
1997-09-09  0:00           ` Arthur Evans Jr
     [not found]             ` <dewar.873953300@merv>
1997-09-11  0:00               ` Robert Dewar
1997-09-11  0:00                 ` Dean F. Sutherland
1997-09-12  0:00                   ` Robert A Duff
1997-09-11  0:00                 ` Arthur Evans Jr
1997-09-12  0:00                   ` Robert A Duff
1997-09-12  0:00                   ` Robert Dewar
1997-09-07  0:00 ` Robert Dewar
1997-09-08  0:00   ` Tucker Taft
1997-09-12  0:00 ` Robert A Duff
1997-09-12  0:00   ` Michael & Amy Hartsough
1997-09-13  0:00   ` Matthew Heaney
1997-09-14  0:00     ` Robert A Duff
1997-09-16  0:00       ` Brian Rogoff
1997-09-18  0:00         ` Robert Dewar
1997-09-18  0:00           ` Brian Rogoff
1997-09-18  0:00         ` Robert A Duff
1997-09-18  0:00           ` Overload Resolution in Ada (Re: The Red Language) Brian Rogoff
1997-09-19  0:00             ` Robert A Duff
1997-09-19  0:00               ` Brian Rogoff
1997-09-20  0:00                 ` Robert Dewar
1997-09-19  0:00             ` Robert Dewar
1997-09-19  0:00           ` The Red Language Robert Dewar
1997-09-19  0:00             ` Robert A Duff
1997-09-21  0:00               ` Robert Dewar
1997-09-21  0:00                 ` Algol 68 references (Was Re: The Red Language) Brian Rogoff
1997-09-22  0:00                   ` Mark L. Fussell
1997-09-22  0:00                 ` The Red Language Chris Morgan
1997-09-22  0:00                 ` Richard A. O'Keefe
1997-09-25  0:00                   ` Bruce Link
1997-09-22  0:00                 ` Richard Kenner
1997-09-30  0:00               ` Charles Lindsey
1997-10-03  0:00                 ` Robert I. Eachus
1997-09-19  0:00             ` Brian Rogoff
1997-09-18  0:00         ` Robert Dewar
1997-09-18  0:00           ` Robert A Duff
1997-09-20  0:00             ` Robert Dewar [this message]
1997-09-22  0:00               ` Robert A Duff
1997-09-16  0:00   ` Brian Rogoff
replies disabled

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