From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,411186037d1bc912 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Some questions about Ada. Date: 1996/05/02 Message-ID: #1/1 X-Deja-AN: 152639183 references: organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-05-02T00:00:00+00:00 List-Id: In article , Carl Laurence Gonsalves 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