comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada Interfaces and the Liskov Substitution Principle
Date: Fri, 1 Jun 2007 16:53:20 +0200
Date: 2007-06-01T16:51:00+02:00	[thread overview]
Message-ID: <1r1lyrsyvr52v$.vx1t785sxb9u.dlg@40tude.net> (raw)
In-Reply-To: 1180704750.516171.126220@h2g2000hsg.googlegroups.com

On Fri, 01 Jun 2007 06:32:30 -0700, Maciej Sobczak wrote:

> On 1 Cze, 09:29, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
> 
>> You are trying to invent some alternative meaning for class-wide.
> 
> Not really.
> There is a difference between this:
> 
> X : T'Class := Y;
> 
> and this:
> 
> X := Y;  -- with X, Y : T'Class;
> 
> The difference is coming from the fact that T'Class gets bound at
> initialization only and cannot change its binding (tag for you) later
> on (X cannot change the actual type).

This is a constraint. It does not change the meaning of T'Class.

The pragmatic argument is that this constraint cannot be checked at compile
time, so you cannot make it illegal.

The formal argument is that values of T'Class are supposed to mimic ones of
the specific types from class T (generic programming etc). So IF T (the
root type of the class) has a primitive subprogram F then T'Class shall act
on it. This is the definition of class and primitive subprograms of. In
particular, if T has ":=" that is equivalent to polymorphic ":=" being
defined on T'Class. There is no obvious way to change this, otherwise than
by providing another definition of T'Class and class T and primitive
subprograms of or claiming that there is a semantic difference between X:=Y
and Assign(X,Y). I don't want a language with magical, semantically
non-decomposable assignments.

[Contravariant operations of T'Class have been discussed earlier]

> In other words, X can become equivalent to Y by initialization, but
> not by assignment. The latter is already too late - you might be
> assigning Triangles to Circles.
> This is what makes T'Class different from T.

No, it makes different construction from example and assignment. They are
indeed different, however one could be defined in terms of another. But
this by no means influences the semantics of T'Class.

>>> You don't need to assign it. It is enough if you can replace it.
>>
>> Care to explain difference?
> 
> You can replace a Circle with a Triangle but you better not try to
> assign them.

This is not an explanation. Show a semantic difference between changing a
name binding from one value to another by A) "replacement" and B)
"assignment."

Ah, wouldn't replacement double dispatching? Then let "assignment" :=
"replacement," and we are back where we started from. (:-))

> No, hierarchies and values don't go together. I might lack the
> formalism to prove it, but my observations are confirming: I've never
> seen it in the wild.

Lacking formalism is not an excuse, it is an indictment. (:-))

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-06-01 14:53 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-23 19:47 Ada Interfaces and the Liskov Substitution Principle Stefan Lucks
2007-05-23 20:32 ` Ludovic Brenta
2007-05-23 22:00   ` Randy Brukardt
2007-05-24  0:56     ` Anh Vo
2007-05-24 18:27     ` Pascal Obry
2007-05-24 18:39       ` Dmitry A. Kazakov
2007-05-24 18:51         ` Pascal Obry
2007-05-24 22:44         ` Randy Brukardt
2007-05-24  6:57   ` Stefan Lucks
2007-05-23 20:54 ` Maciej Sobczak
2007-05-23 21:58   ` Randy Brukardt
2007-05-24  7:29     ` Maciej Sobczak
2007-05-24  8:02       ` Dmitry A. Kazakov
2007-05-24 12:58         ` Maciej Sobczak
2007-05-24 13:42           ` Dmitry A. Kazakov
2007-05-24 22:08           ` Robert A Duff
2007-07-01  1:00             ` David Thompson
2007-05-24 22:58           ` Randy Brukardt
2007-05-25  7:52             ` Maciej Sobczak
2007-05-25  8:21               ` Dmitry A. Kazakov
2007-05-25 20:27                 ` Maciej Sobczak
2007-05-26  7:48                   ` Dmitry A. Kazakov
2007-05-27  8:30                     ` Maciej Sobczak
2007-05-27 10:04                       ` Dmitry A. Kazakov
2007-05-29  8:03                         ` Maciej Sobczak
2007-05-29 13:18                           ` Dmitry A. Kazakov
2007-05-29 13:32                             ` Dmitry A. Kazakov
2007-05-29 15:34                             ` Maciej Sobczak
2007-05-29 17:07                               ` Dmitry A. Kazakov
2007-05-30  7:40                                 ` Maciej Sobczak
2007-05-30  8:43                                   ` Dmitry A. Kazakov
2007-05-30 12:54                                     ` Maciej Sobczak
2007-05-30 13:56                                       ` Dmitry A. Kazakov
2007-05-30 16:49                                         ` vgodunko
2007-05-30 20:52                                         ` Maciej Sobczak
2007-05-31  8:15                                           ` Dmitry A. Kazakov
2007-05-31 13:46                                             ` Maciej Sobczak
2007-06-01  7:29                                               ` Dmitry A. Kazakov
2007-06-01 13:32                                                 ` Maciej Sobczak
2007-06-01 14:53                                                   ` Dmitry A. Kazakov [this message]
2007-06-01 20:31                                                     ` Maciej Sobczak
2007-06-02  8:19                                                       ` Dmitry A. Kazakov
2007-06-02 16:49                                                         ` Maciej Sobczak
2007-06-03  7:09                                                           ` Dmitry A. Kazakov
2007-06-03 22:04                                                             ` Maciej Sobczak
2007-06-04  8:08                                                               ` Dmitry A. Kazakov
2007-06-04 17:02                                                                 ` Maciej Sobczak
2007-06-05  8:35                                                                   ` Dmitry A. Kazakov
2007-06-05 22:12                                                                     ` Maciej Sobczak
2007-06-06  8:21                                                                       ` Dmitry A. Kazakov
2007-06-06 14:46                                                                         ` Maciej Sobczak
2007-06-06 15:11                                                                           ` Maciej Sobczak
2007-06-06 15:32                                                                       ` Markus E Leypold
2007-05-24 10:42       ` Georg Bauhaus
2007-05-24 13:41         ` Dmitry A. Kazakov
2007-05-25 16:59         ` Markus E Leypold
2007-05-28  9:52           ` Georg Bauhaus
2007-05-28 11:50             ` Dmitry A. Kazakov
2007-05-28 23:32               ` Georg Bauhaus
2007-05-29 12:05                 ` Dmitry A. Kazakov
2007-05-29 13:33                 ` Georg Bauhaus
2007-05-29 17:29                   ` Dmitry A. Kazakov
2007-05-29 20:46                     ` Georg Bauhaus
2007-05-30  7:53                       ` Dmitry A. Kazakov
2007-05-30 13:18                       ` Georg Bauhaus
2007-05-31 10:27                         ` Dmitry A. Kazakov
2007-05-31 11:44                         ` Georg Bauhaus
2007-06-01  7:37                           ` Dmitry A. Kazakov
2007-06-01 10:07                             ` Markus E Leypold
2007-06-01 11:41                             ` Georg Bauhaus
2007-06-01 13:07                               ` Dmitry A. Kazakov
2007-05-28 13:47             ` Markus E Leypold
2007-05-28 23:12               ` Georg Bauhaus
2007-05-28 13:56             ` Markus E Leypold
2007-05-28 23:00               ` Georg Bauhaus
2007-05-24  7:39 ` Dmitry A. Kazakov
2007-05-24 11:12   ` Stefan Lucks
2007-05-24 13:56     ` Dmitry A. Kazakov
2007-05-24 14:41       ` Stefan Lucks
2007-05-24 15:46         ` Dmitry A. Kazakov
2007-05-24 15:00       ` Georg Bauhaus
replies disabled

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