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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: G. B. Newsgroups: comp.lang.ada Subject: Re: class wide iterable (and indexable) Date: Tue, 8 Jan 2019 18:32:58 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <2a6929c5-72fa-4d84-953a-44ea4597ab38@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 8 Jan 2019 18:32:58 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="036d538d822f32c19eb267584dba87c6"; logging-data="19983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EmuzBTRVfWY6DuFCfkjZoflthnO91INI=" User-Agent: NewsTap/5.3.1 (iPhone/iPod Touch) Cancel-Lock: sha1:yL9+nvvsCQwykk5RdBc/kxTLU0w= sha1:NmVnBqBIGFtY6s3R6lbtJfXVZGk= Xref: reader01.eternal-september.org comp.lang.ada:55244 Date: 2019-01-08T18:32:58+00:00 List-Id: Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:q0pvlp$1vp1$1@gioia.aioe.org... > That's primarily the job of package specifications, how the contents are > structured isn't very relevant from a description standpoint. > > ... >>> ... >>>> No, interfaces cannot contain common code except for class-wide one. Is >>>> that what Randy meant about overhead? >>> >>> Not really. My main point is that you'll never have more than one >>> concrete >>> instance of a generic interface in any individual program (certainly not >>> of >>> an interface like that of a container), >> >> I don't understand this. Usually I have dozens of instantiations of the >> same generics with different actual parameters. > > Right, but all of those are *different* interfaces because they have > *different* generic parameters. You can't mix those types in any useful way, > because you almost always have the generic parameter type(s) involved. > > For instance, for the containers, an interface would have to contain the > element type. But that substantially limits reuse, because almost every > container instance would have a different element type. You can't even pass > just the interface into a generic because you wouldn't be able to call the > primitives without knowing the element type. To make such a reuse possible > you'd have to pass so many parameters that you are typing instantiations for > days. And then the compilation time also would be days. You'd have to be > slightly mad to even try it. :-) For software design, then, does it seem reasonable to assume that the result of a generic instantiation is not for reuse, but for use? So that, therefore, if an algorithm can handle different instances of a generic, this algorithm would specify them through a generic formal? (Inversion of structure.)