[comp.lang.ada] Case insensitivity

banderso@sagpd1.UUCP (Bruce Anderson) (02/19/89)

As background, I work for a company which uses C primarily but since
we do work for the government we are in the process of being forced to
switch over to Ada. I do not currently work on a project which uses Ada
but I have been somewhat interested in the language at least to the 
point of taking a class in it (unfortunately the worst technical
course I have taken in my life but that's another story). I try to 
read this group somewhat regularly to garner whatever I can from it
so basically I am a novice (at best) at the language.

Given that, one of the things which I dislike the most about the language
is its case-insensitivity and although I hadn't given it much thought
I guess I had assumed that this was likely to be a somewhat common
opinion. In a recent article however, the author made a comment which
indicated that he felt that it was stupid to have a case-sensitive 
language.

My question is, does everyone think that the case-insensitivity of
Ada is a positive feature and if so why? Personally, if I see a
variable 'aBcDe' and another one 'AbCdE' they don't immediately strike
me as being the same and is therefore confusing when they are.

Bruce Anderson - Scientific Atlanta, Government Products Division
...!sagpd1!banderso

sommar@enea.se (Erland Sommarskog) (02/19/89)

So another non-important subject to have a long debate on!

Bruce Anderson (banderso@sagpd1.UUCP) writes:
>My question is, does everyone think that the case-insensitivity of
>Ada is a positive feature and if so why? Personally, if I see a
>variable 'aBcDe' and another one 'AbCdE' they don't immediately strike
>me as being the same and is therefore confusing when they are.

I'm somewhat split in this issue. I have never worked with case-
sensentive language except for the Unix file system where it is a pain.
(Was it an uppercase or not? Never remember.) Wait, Berkley Pascal
on Unix is case sensitive. Nice when your are porting programs...

I have been bitten by the trap I've hidden an outer constant (upper case 
only) with a local variable (upper case initial) and it took me quite
a while to see what I have done, when the comparison with the constant 
didn't give the expected result. 

On the other hand, in a case-sensitive language you declare: 
   Word_length : integer;
Someone else with another coding style comes in and modifies 
the program and in an inner block and adds:
   word_length : integr;
Then a third person modifies this block, and sloppily writes
   Something := Word_length;
and don't get corrected by the compiler.

Maybe a good rule would be to require the case in the declaration
to be kept, and disallow variation. I.e. once you have declared
"Word_length" you may not write "word_length" until you declare 
that name, which then hides "Word_length".
-- 
Erland Sommarskog
ENEA Data, Stockholm              This signature is not to be quoted.
sommar@enea.se

billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,) (02/20/89)

From article <317@sagpd1.UUCP>, by banderso@sagpd1.UUCP (Bruce Anderson):
> My question is, does everyone think that the case-insensitivity of
> Ada is a positive feature and if so why? Personally, if I see a
> variable 'aBcDe' and another one 'AbCdE' they don't immediately strike
> me as being the same and is therefore confusing when they are.

    I think the basic idea is that variables of the forms described above
    are being deliberately discouraged.  Instead of User and useR, then, 
    one is forced to be more descriptive (Administrative_User, Student_User),
    thus enhancing the documentation of the program.

    A programming language does not exist only to PERMIT applications to be
    developed.  A good design must also take into account the fact that a
    language guides the way its users think and act.  By establishing certain
    possibilities as things which are necessary only for the purpose of 
    creating undesirable programs, and eliminating those potential modes of
    behavior, a language can help you to converge quickly on a high-quality 
    solution.  In this case, the quality metric is maximization of the extent 
    to which variable names are loaded with semantic information.  Two or more
    variables must either be collapsed into a single variable, or must be given
    different names, even if it's nothing more than User_1 and User_2. 

    Therefore, I see it as a positive feature, one which results in better
    programs.


    Bill Wolfe, wtwolfe@hubcap.clemson.edu

terry@moogvax.UUCP (Terry Westley) (02/20/89)

In article <317@sagpd1.UUCP> banderso@sagpd1.UUCP (Bruce Anderson) writes:
>My question is, does everyone think that the case-insensitivity of
>Ada is a positive feature and if so why? Personally, if I see a
>variable 'aBcDe' and another one 'AbCdE' they don't immediately strike
>me as being the same and is therefore confusing when they are.

Yes, I do:

1) Although natural language is case sensitive in proper usage, it is not 
   necessary for understanding.  i'm sure you know what i mean.

2) I use C just as much as Ada.  Case sensitivity is a minor
   annoyance in a language that requires human perfection.  By this I
   mean that the compiler does not catch as many typos and careless
   mistakes as an Ada compiler.  I believe that the programmer and the
   compiler have different strengths and that compilers and languages
   should be designed with that in mind.

-- 
  Terry Westley         
  Moog, Inc. (no, not the synthesizer company)
  East Aurora, NY  14052-0018
  {boulder,decvax,rocksanne,rutgers,ames}!sunybcs!moogvax!terry

rfarris@serene.UUCP (Rick Farris) (02/21/89)

In article <317@sagpd1.UUCP> banderso@sagpd1.UUCP (Bruce Anderson) writes:

> I do not currently work on a project which uses Ada but I have been
> somewhat interested in the language at least to the point of taking a
> class in it (unfortunately the worst technical course I have taken in
> my life but that's another story).

I'm curious to know what course you took.  Here in San Diego, there
are very few courses given in Ada.  I'm studying for my Master's in
Software Engineering at National University, and it is taught in Ada.
I've found the National Ada courses to be excellent.  You may want to
investigate them.

> My question is, does everyone think that the case-insensitivity of
> Ada is a positive feature and if so why? Personally, if I see a
> variable 'aBcDe' and another one 'AbCdE' they don't immediately strike
> me as being the same and is therefore confusing when they are.

The case-insensitivity bothered me also, but I've managed to overcome
my objections.  1) It *is* rather pathological to use the same
identifier with a different case, and expect it to refer to a
different object.  Yes, I've done it in C, usually to differentiate
between a typedef and an object of the type, but it isn't really very
good practice.  2) Ada doesn't prohibit you from using case to
signify differences to *you*.  For instance, if you'd like, you can
make your manifest constants in upper case, your global variables
capitalized, and your local variables in lower case.

In your example above, (aBcDe vs. AbCdE), this case should never
arise.  If you've used aBcDe, you should not use AbCdE in your
program.  I hope you don't do this in the language you're used to.
(Probably C) 


Rick Farris   RF Engineering  POB M  Del Mar, CA  92014   voice (619) 259-6793
rfarris@serene.cts.com     ...!uunet!serene!rfarris       serene.UUCP 259-7757

mcdonald@uxe.cso.uiuc.edu (02/23/89)

In article <317@sagpd1.UUCP> banderso@sagpd1.UUCP (Bruce Anderson) writes:
>My question is, does everyone think that the case-insensitivity of
>Ada is a positive feature and if so why? Personally, if I see a
>variable 'aBcDe' and another one 'AbCdE' they don't immediately strike
>me as being the same and is therefore confusing when they are.

Why care? This is one of the lesser concerns about a language.