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=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_24_48, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,66fae8c862b81b17 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.66.87.73 with SMTP id v9mr2626100paz.46.1352353230907; Wed, 07 Nov 2012 21:40:30 -0800 (PST) From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Copy vector in Ada Date: Tue, 06 Nov 2012 20:47:58 +0100 Organization: Ada @ Home Message-ID: References: <1aWdnbcg_8-BzAzNnZ2dnUVZ_j6dnZ2d@giganews.com> <6260a796-83c4-4ce5-88cb-8249846bc035@googlegroups.com> <10y91ckm54l57$.8u8bbq342u1b.dlg@40tude.net> <2164bc1a-a841-46ed-bfef-4ddcae4d64f7@googlegroups.com> <1ccf2169-418c-44b7-9d5a-b684a017fbe7@googlegroups.com> <1r3lpzblxy43h$.zytp8ur1bg27$.dlg@40tude.net> <1k3sjasg1wftm$.1vlq5hm7vukhk.dlg@40tude.net> <1sinhhpvja1gx.1ue7br8bz2slq$.dlg@40tude.net> <5098f58c$0$6558$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: aWaWeUaBdaj2Zzc04J1v5A.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.02 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Path: s9ni86874pbb.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.mccarragher.com!news.grnet.gr!newsfeed.CARNet.hr!aioe.org!.POSTED!not-for-mail Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-11-06T20:47:58+01:00 List-Id: Le Tue, 06 Nov 2012 12:33:32 +0100, Georg Bauhaus = a =C3=A9crit: > On 06.11.12 03:17, Yannick Duch=C3=AAne (Hibou57) wrote: >> When you do: >> >> type My_Integer_Type is new Integer range -10 .. 10; >> >> you do this just to reuse the Integer type's physical representation = = >> and built=E2=80=91in primitives, not to define a type belonging to an= Integer = >> class. > > Actually, one can specify a physical representation of > My_Integer_Type that is different from Integer's. Also, > one may supplant or subtract "primitives". > > When I do not need type substitution, e.g. because all > objects do their work well, and locally, then the solution is > to adapt notions of type to the solution at hand as necessary, > and if necessary at all, rather than to force working solutions > to match orthodox notions of type. Nothing wrong with the > latter, globally. This has nothing to do with orthodoxy, that's proper naming of things. = Confusing both kind of inheritance (and one is not even inheritance), = leads to mixing things with no sense, and that's what I believe had lead= = to Python's duck=E2=80=91typing (personal opinion here). As explained, b= oth = inheritance contradicts in near to everything. When both are mixed, the = = only things which seems to remains preserved, is operation's names, and = = here you get it: duck=E2=80=91typing. OOP religion (at least a view of O= OP) = contributed to this misunderstanding, as it promoted inheritance as the = = Holy Grail good to everything, and it indeed promoted inheritance for = reuse (which is wrong). I did not want to say the numeric type hierarchy must not be used, just = = that it must not be confused with the interface hierarchy, as Shark8 did= . Now, talking about proper naming of things, how would you explain to a = student, that sometime =E2=80=9Ctype=E2=80=9D must follow the substituti= on principle, and = sometime, it do exactly the opposite? That's why I said it would have be= en = better to have Ada requires to write =E2=80=9Csubtype XYZ is new=E2=80=9D= instead of =E2=80=9Ctype = XYZ is new=E2=80=9D, in such cases. > Actually, one can specify a physical representation of > My_Integer_Type that is different from Integer's. Also, > one may supplant or subtract "primitives". Yes, it was to keep it simple. You are still reusing anyway (the primiti= ve = operations, automatically generated checks). -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity