comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Some questions about Ada.
Date: 1996/05/02
Date: 1996-05-02T00:00:00+00:00	[thread overview]
Message-ID: <DqsM0J.ErG@world.std.com> (raw)
In-Reply-To: DqrD2C.Jyr@undergrad.math.uwaterloo.ca


In article <DqrD2C.Jyr@undergrad.math.uwaterloo.ca>,
Carl Laurence Gonsalves <clgonsal@undergrad.math.uwaterloo.ca> wrote:
>One thing I'm wondering about is packages. I've heard that packages are
>"better" than than the way C++ uses classes. I'm curious as to why this is.
>Modula-3 has modules (which are similar, AFAIK, to Ada's packages) and
>"object types" (classes) as two distinct entities. I'v always thought that
>C++'s way of allowing just about anything to be nested in a class much
>cleaner and simpler. (and for the record, I was programming in Modula-3
>before I was programming in C++) So are packages better? Why?

This question has been discussed endlessly here.  Some folks think the
Ada/Modula-3 way is better.  Some think the C++/Smalltalk way is better.
Check out the recent thread on Eiffel vs. Ada 95, for some arguments
both ways.  I happen to think the Ada/Modula-3 way is better, but I
don't think it's all that important -- it's mostly a notational
difference.

>Second, I've been wondering why Ada is case-insensitive. I'm aware that Ada
>was very carefully designed, so I'm thinking there must be some reason it
>was made case-insensitive rather than case-sensitive, but I can't imagine
>what that reason could be.

There are many fanatics who think case-sensitive is "obviously" the only
way to go, and many fanatics who think case-insensitive is "obviously"
the way to go.  People get very hot about this particular issue.
Apparently, you're one of the former, and the designers of Ada 83 were
the latter.

IMHO, it doesn't matter all that much.  If Ada were case sensitive, and
C++ case insensitive, I would still think Ada is better for most
purposes.  It all depends on what you're used to.  Mathemeticians are
perfectly happy to make x and X mean two different things, and they've
been around a lot longer than computers, so...

In any case, this decision was set down in Ada 83, and Ada 95 wasn't
about to change it.  (Same thing with C++ -- the reason C++ is case
sensitive is because C is case sensitive -- it has nothing to do with
whether Stroustrup thinks it's a good idea.)

The problem with case sensitivity, is that you can define two things i
and I that are different variables, and that makes code less readable.
The problem with case INsensitivity, is that you can define a variable
I, and refer to it as i, and that makes code less readable.  IMHO, the
"right" solution is neither one.  How about this rule:

    Overload resolution is performed in a case INsensitive manner.

    AFTER overload resolution, a legality rule is that each reference
    to something has to use the same case as the declaration.

    And, oh, by the way, make everything overloadable, not just
    subprogram names.

?

This would allow you to declare two things with the same name but for
case, so long as they are distinguishable by the overload resolution
rules.  And it would prevent the confusing thing of referring to I as i.

Whatever the overload resolution rules are, if they tolerate two things
called I and I, then they will tolerate two things called I and i.  But
having defined I and i, one has to refer to them in the right case.

Now, is this legal:

    procedure P(t: T);

?  Well, that depends on whether your overloading rules can distinguish
variables from types.  (In Ada, variable and type names are not
overloadable, which has nothing to do with the case-sensitivity rules.
If the above *were* legal, I wouldn't want a reference to t or T to
depend *merely* on case.  I would want the syntactic context to provide
clues as well.)

- Bob




  reply	other threads:[~1996-05-02  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-02  0:00 Some questions about Ada Carl Laurence Gonsalves
1996-05-02  0:00 ` Robert A Duff [this message]
1996-05-02  0:00 ` Dave Jones
1996-05-03  0:00   ` Darren C Davenport
1996-05-03  0:00   ` Spencer Allain
1996-05-03  0:00   ` Carl Laurence Gonsalves
1996-05-03  0:00     ` Dave Jones
1996-05-03  0:00     ` Adam Beneschan
1996-05-04  0:00       ` Carl Laurence Gonsalves
1996-05-04  0:00       ` Robert Dewar
1996-05-04  0:00         ` Robert A Duff
1996-05-04  0:00           ` Robert Dewar
1996-05-05  0:00             ` Robert A Duff
1996-05-05  0:00               ` Arthur Evans Jr
1996-05-05  0:00                 ` Robert Dewar
1996-05-06  0:00                   ` Norman H. Cohen
1996-05-06  0:00                     ` David Weller
1996-05-07  0:00                       ` Robert Dewar
1996-05-12  0:00                         ` Geert Bosch
1996-05-05  0:00                 ` Robert Dewar
1996-05-06  0:00                 ` Christopher J. Henrich
1996-05-04  0:00         ` Kevin D. Heatwole
1996-05-04  0:00         ` Richard Kenner
1996-05-04  0:00           ` Robert Dewar
1996-05-05  0:00             ` Richard Kenner
1996-05-05  0:00               ` Robert Dewar
1996-05-06  0:00         ` Norman H. Cohen
1996-05-06  0:00           ` Robert Dewar
1996-05-03  0:00     ` Michael Feldman
1996-05-03  0:00     ` Robert A Duff
1996-05-06  0:00     ` Laurent Guerby
1996-05-06  0:00   ` Matthew M. Lih
1996-05-09  0:00     ` Dave Jones
1996-05-03  0:00 ` Laurent Guerby
1996-05-03  0:00   ` Robert A Duff
replies disabled

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