comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Copy vector in Ada
Date: Tue, 06 Nov 2012 20:47:58 +0100
Date: 2012-11-06T20:47:58+01:00	[thread overview]
Message-ID: <op.wndal8g5ule2fv@cardamome> (raw)
In-Reply-To: 5098f58c$0$6558$9b4e6d93@newsspool4.arcor-online.net

Le Tue, 06 Nov 2012 12:33:32 +0100, Georg Bauhaus  
<rm.dash-bauhaus@futureapps.de> a écrit:

> On 06.11.12 03:17, Yannick Duchêne (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‑in 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‑typing (personal opinion here). As explained, both  
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‑typing. OOP religion (at least a view of OOP)  
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 “type” must follow the substitution principle, and  
sometime, it do exactly the opposite? That's why I said it would have been  
better to have Ada requires to write “subtype XYZ is new” instead of “type  
XYZ is new”, 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 primitive  
operations, automatically generated checks).


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



  reply	other threads:[~2012-11-08  5:40 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 16:26 Copy vector in Ada katolsster
2012-10-31 16:37 ` Jeffrey Carter
2012-11-02 11:10   ` katarina.l.olsson
2012-11-02 11:19     ` Yannick Duchêne (Hibou57)
2012-11-02 22:03       ` Maciej Sobczak
2012-11-02 23:45         ` Yannick Duchêne (Hibou57)
2012-11-03  0:15           ` Zhu, Qun-Ying
2012-11-03  3:47             ` Peter C. Chapin
2012-11-03 15:47               ` Yannick Duchêne (Hibou57)
2012-11-03 14:34           ` Maciej Sobczak
2012-11-03 15:54             ` Yannick Duchêne (Hibou57)
2012-11-03 16:03               ` Yannick Duchêne (Hibou57)
2012-11-03 21:57                 ` Maciej Sobczak
2012-11-04  7:25                   ` Dmitry A. Kazakov
2012-11-04 20:49                     ` Maciej Sobczak
2012-11-05  8:31                       ` Dmitry A. Kazakov
2012-11-05  8:50                         ` Maciej Sobczak
2012-11-05  9:20                           ` Dmitry A. Kazakov
2012-11-05 17:22                             ` Yannick Duchêne (Hibou57)
2012-11-05 18:42                               ` Dmitry A. Kazakov
2012-11-05 20:18                                 ` Yannick Duchêne (Hibou57)
2012-11-05 20:33                                   ` Dmitry A. Kazakov
2012-11-05 21:34                                     ` Yannick Duchêne (Hibou57)
2012-11-05 23:45                                       ` Shark8
2012-11-05 23:58                                         ` Hibou57 (Yannick Duchêne)
2012-11-06  2:17                                           ` Yannick Duchêne (Hibou57)
2012-11-06  7:28                                             ` Types vs Subtypes (was: Re: Copy vector in Ada) Simon Wright
2012-11-06 11:33                                             ` Copy vector in Ada Georg Bauhaus
2012-11-06 19:47                                               ` Yannick Duchêne (Hibou57) [this message]
2012-11-06 19:53                                                 ` Yannick Duchêne (Hibou57)
2012-11-07 12:03                                                 ` Georg Bauhaus
2012-11-07 13:09                                                   ` Dmitry A. Kazakov
2012-11-07 16:17                                                     ` Yannick Duchêne (Hibou57)
2012-11-07 16:11                                                   ` Yannick Duchêne (Hibou57)
2012-11-07 18:06                                                     ` Georg Bauhaus
2012-11-07 20:04                                                       ` Dmitry A. Kazakov
2012-11-07 21:00                                                         ` Yannick Duchêne (Hibou57)
2012-11-08  8:31                                                           ` Dmitry A. Kazakov
2012-11-08  9:58                                                         ` Georg Bauhaus
2012-11-08 14:28                                                           ` Dmitry A. Kazakov
2012-11-05 16:30                         ` Yannick Duchêne (Hibou57)
2012-11-02 14:10     ` Georg Bauhaus
2012-11-02 15:28       ` Shark8
2012-11-09  6:22         ` Randy Brukardt
2012-11-19 22:37 ` Katarina Olsson
2012-11-19 22:39 ` Katarina Olsson
replies disabled

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