comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Generics vs. O-O?
Date: Fri, 02 Aug 2013 00:20:47 +0200
Date: 2013-08-02T00:20:48+02:00	[thread overview]
Message-ID: <51fadf40$0$6557$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <1wugpqyea6s39$.e2e8eshup5wn$.dlg@40tude.net>

On 01.08.13 21:24, Dmitry A. Kazakov wrote:

> 7. Formal generic types of Ada are weakly typed. Matching is by structure.
> User-defined generic types (ADTs) are not supported. User-defined
> operations on formal types are not supported. The language of formal
> generic parameters is somewhere between FORTRAN-IV and K&R C.

Not quite far from a misrepresentation of Ada generics.
Nothing in the languages mentioned can require type equivalence
by name in whatever generic formals, as in

package N is

   type T is range -1 .. 1;

   generic
     type S is new T;
   package Pointless is end;

   type Q is range -1 .. 1;

   package Exmpl is new Pointless (Q);  -- error

end N;

Equivalent structure of scalar types T and Q won't do.

> 9. Generic units are basically non-testable. Substitutability issues are
> difficult to verify because of 7.

With generics, substitutability issues arise as soon as one wishes to subsume
the mechanism of generic units under a formally extraneous type systems.
So, judicious use of this language features for things other than typing
might be the better choice.


In general, attributing "weakly typed" to languages will profit
from being done in a more detailed, more informative, and therefore
more convincing  way. The C example

struct A {};
struct B {};

int f(struct A x) {}
int g(struct B y) {}

void test()
{
   f((struct B){});  /* compile time type error */
}

shows that C is not entirely weakly typed!



  parent reply	other threads:[~2013-08-01 22:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 14:45 Generics vs. O-O? Eryndlia Mavourneen
2013-08-01 19:24 ` Dmitry A. Kazakov
2013-08-01 19:52   ` Eryndlia Mavourneen
2013-08-01 20:14     ` sbelmont700
2013-08-01 23:35       ` Yannick Duchêne (Hibou57)
2013-08-01 20:10   ` optikos
2013-08-01 20:26     ` Dmitry A. Kazakov
2013-08-01 20:35     ` Jeffrey Carter
2013-08-01 21:22     ` Bill Findlay
2013-08-01 23:38     ` Yannick Duchêne (Hibou57)
2013-08-01 22:20   ` Georg Bauhaus [this message]
2013-08-02  8:11     ` Dmitry A. Kazakov
2013-08-02  9:50       ` Georg Bauhaus
2013-08-02 14:09         ` Dmitry A. Kazakov
2013-08-02 15:08           ` Shark8
2013-08-02 15:36             ` Alan Jump
2013-08-02 17:00               ` Jeffrey Carter
2013-08-02 17:51               ` Dmitry A. Kazakov
2013-08-02 18:06                 ` Alan Jump
2013-08-02 19:08                   ` Dmitry A. Kazakov
2013-08-02 16:15             ` Dmitry A. Kazakov
2013-08-03  0:04       ` Yannick Duchêne (Hibou57)
2013-08-03  7:35         ` Georg Bauhaus
2013-08-03  8:57           ` Dmitry A. Kazakov
replies disabled

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