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,cb4b02eafef9cefb X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Difference between ADA and c++ Date: 1997/08/27 Message-ID: #1/1 X-Deja-AN: 268728189 References: <33FDD17A.320B@virgin.net> <01bcafdf$50784b80$7774d8cc@fatman> <340340C1.72A7@pseserv3.fw.hac.com> <3403A080.2A07@pseserv3.fw.hac.com> Newsgroups: comp.lang.ada Date: 1997-08-27T00:00:00+00:00 List-Id: On Wed, 27 Aug 1997, W. Wesley Groleau x4923 wrote: > I agree that tons of instantiations can be a lot of clutter. > However, every time I have come across tons of instantiations, > it has been because someone (1) had an aversion to putting unrelated > items in distinct packages, (2) had a bad habit of declaring several > types that all did the same thing (zillions of type conversions > is another symptom of this one) and/or (3) had an aversion to higher > level generics when there was clearly a lot of unnecessary repetition. OK, I have no such problem to seeking out the best use of the features of the language to enhance readability. I read my own code, and I have a small brain. But, I make heavy use of genericity as an abstraction mechanism. > I can see from your responses to RBKD and JSA that there may be > times where your idea would indeed help readability. However, > I still think the potential for misuse is too great. The reason I > equated it with promotions and demotions is that there is the same > potential for problems. I don't see this. The type checker still flags any problems. In fact, I would expect that any inferencing algorithm chosen would be particularly conservative, and not allow many legal automatic instantiations. These would then have to be explicitly instantiated. > With a type mismatch in Ada, the compiler > forces you to be sure you know what you're doing. In C, the compiler > assumes you know what you're doing and automatically forces the > variables to cooperate--no matter what the result. That is automatic *coercion* of types, not type inference. I suggest you read Shen and Cormack's Tri-Ada 91 paper in order to get an idea of what I am proposing. > To me, having the > compiler implicitly overload instantiations on different types is > similar (although clearly not as dangerous as promotions and demotions). More dangerous than regular overloading of subprograms based on argument types? More dangerous than use clauses? Sounds like you'd prefer Modula 3 or Oberon to Ada, at least on these grounds. I *prefer* these aspects of Ada. -- Brian