comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada Interfaces and the Liskov Substitution Principle
Date: Sat, 02 Jun 2007 09:49:38 -0700
Date: 2007-06-02T09:49:38-07:00	[thread overview]
Message-ID: <1180802978.626766.128330@h2g2000hsg.googlegroups.com> (raw)
In-Reply-To: <bluidejuaxlk$.1551mws1qca5i.dlg@40tude.net>

On 2 Cze, 10:19, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:

> > The difference is that (in Ada terms) replacement
> > allows you to change the tag. Assignment cannot do this.
>
> Neither can.

Yes, replacement can change the tag. It's the tag of referred object
that can change. An access variable can point to Circle and then to
Triangle. This is the kind of replacement I'm talking about.
But you cannot assign Triangle to Circle.

> But to show this we'd need to formalize it. Briefly: types
> access T and T are different types.

Sure. It's just not the type of reference I'm interested in in a
regular program, but the type of referred object.

> The semantic of assignment of access T
> is not one of T, and neither is of the assignment of T'Class! It is a typed
> language, after all...

Of course. That's why it is useful to distinguish them. And since we
came here from the notion of strategies (in strings, but that was so
long ago that it barely matters now), then replacing one strategy with
another can be implemented in terms of assigning access variables. It
is just not the level of abstraction I'm interested in. I don't care
about access variables. What I care about is the fact that I can
replace one strategy with another.

I can also replace a wheel in my car but it's not assignment of
wheels.

Replacement and assignment are different things from the design point
of view, even if replacement for T is implemented in terms of
assignment for access T - that's just not the level of detail I care
about.

> >> Ah, wouldn't replacement double dispatching?
>
> > No, it wouldn't and that's the second difference. Replacement just
> > gets rid of the current value before the new value is refered to,
> > which means that from the dispatching point of view this operation is
> > simply linear on right-hand-side - it's a pure single dispatch.
>
> No, this does not work. Apart from being semantically wrong in general
> case, it is technically wrong.

Why is it semantically wrong?
Consider replacing wheels in your car.

> You have to dispatch to finalize LHS. You
> have to dispatch to re-construct it from RHS.

It doesn't change anything in my reasoning. Two linear dispatches
don't magically give you double dispatch! In terms of implementation
complexity, it is O(n+m) problem, not O(n*m).

The difference comes from the fact that finalizing LHS has no
influence on re-constructing from RHS.

> > Assignment has to be '2D' with both axes, or O(n2) in terms of
> > implementation complexity. It has to be double-dispatching to make any
> > sense and this is unrealistic implementation-wise.
>
> It is semantically this way. There is nothing to do about it, but to scrap
> either assignment or class. (We are going in circles)

That's exactly what I'm talking about from the very beginning -
T'Class should be limited.
Is it only my impression that we actually agree? :-)

> (C++ OO model is really poisoning. Don't mix types, just don't.)

In what way is the C++ OO model relevant here?

I'm talking about replacing wheels in my car. Twice a year I *replace*
summer wheels for winter ones and the other way round. I *don't
assign* them.


> Take what you wish, but referential semantic is fundamentally insufficient,
> in the sense that you cannot have a language without values, but only
> references.

Of course, I've never said that. You need both to do anything useful.

> Once you had at
> least one value at the end of the referential chains, you'd have to assign
> (:-)) it and give a type to it.

Yes.

> Then
> because your types algebra has classes one could create a class of. In the
> end you will face the same question again: what is the assignment on the
> class. All this referential stuff is just shifting subjects.

No, it's not shifting subjects. It's actually what makes it possible
to replace wheels in a car. Or encoding strategies in a string object.

--
Maciej Sobczak
http://www.msobczak.com/




  reply	other threads:[~2007-06-02 16:49 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
2007-06-01 20:31                                                     ` Maciej Sobczak
2007-06-02  8:19                                                       ` Dmitry A. Kazakov
2007-06-02 16:49                                                         ` Maciej Sobczak [this message]
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