comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shellx.best.com>
Subject: Re: Difference between ADA and c++
Date: 1997/08/27
Date: 1997-08-27T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SGI.3.95.970827081728.6261C-100000@shellx.best.com> (raw)
In-Reply-To: 3403A080.2A07@pseserv3.fw.hac.com


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
 





  parent reply	other threads:[~1997-08-27  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-22  0:00 Difference between ADA and c++ Mr Doshi
1997-08-23  0:00 ` Robert Munck
     [not found] ` <01bcafdf$50784b80$7774d8cc@fatman>
1997-08-23  0:00   ` Library model in Ada. was " Nasser
1997-08-24  0:00     ` Dale Stanbrough
1997-08-24  0:00       ` Robert Dewar
1997-08-24  0:00     ` Library model in Ada. was " Robert Dewar
1997-08-23  0:00   ` Nasser
1997-08-24  0:00     ` Robert Dewar
     [not found]       ` <340262F6.32D3@mcs.com>
     [not found]         ` <dewar.872614961@merv>
     [not found]           ` <34043769.29EF@gsfc.nasa.gov>
1997-08-27  0:00             ` Robert Dewar
     [not found]         ` <3403FFBA.1FDC@amst.co.at>
     [not found]           ` <34045A8A.52E7@gsfc.nasa.gov>
1997-08-28  0:00             ` Reasons why Ada is no success yet Joachim Schroeer
1997-08-28  0:00         ` Difference between ADA and c++ Samuel Mize
     [not found]         ` <5u3ckv$6bo$1@goanna.cs.rmit.edu.au>
1997-08-29  0:00           ` Michael Young
1997-08-25  0:00   ` Brian Rogoff
     [not found]     ` <340340C1.72A7@pseserv3.fw.hac.com>
     [not found]       ` <Pine.SGI.3.95.970826175504.24873D-100000@shellx.best.com>
     [not found]         ` <3403A080.2A07@pseserv3.fw.hac.com>
1997-08-27  0:00           ` Brian Rogoff [this message]
1997-08-27  0:00           ` Jon S Anthony
     [not found]     ` <5u0hj7$enj$1@goanna.cs.rmit.edu.au>
1997-08-27  0:00       ` Jon S Anthony
     [not found]     ` <dewar.872607709@merv>
     [not found]       ` <JSA.97Aug26152737@alexandria.organon.com>
     [not found]         ` <Pine.SGI.3.95.970826174002.24873B-100000@shellx.best.com>
1997-08-27  0:00           ` Jon S Anthony
1997-08-27  0:00         ` Robert Dewar
1997-08-27  0:00           ` Jon S Anthony
replies disabled

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