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: 30 May 2007 13:52:16 -0700
Date: 2007-05-30T13:52:16-07:00	[thread overview]
Message-ID: <1180558336.041236.211560@p77g2000hsh.googlegroups.com> (raw)
In-Reply-To: <1ljmbgesxien.syhurcvjdcd2$.dlg@40tude.net>

On 30 Maj, 15:56, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:

> >> Referential semantics is an implementation detail.
>
> > No, it is not. It gives you explicitly the possibility to "reseat" the
> > referer as well as sharing semantics. These are not details.
>
> No shared semantics in this context. The values identify themselves,
> otherwise the type shall be limited and no assignment would come in
> question.

When I think about it, it seems to me that you have just pinned down
the very essence of this problem.
There is no need to artificially banning assignments for class-wide
types.
Just force them all to be limited. Problem solved.

I'm not joking.

There is a distinction between value types and object types. These
names might not be meaningful within the Ada terminology, but the
border line is basically between types which instances represent
themselves and those which instances represent external concepts or
entities (but not necessarily). The latter often form hierarchies.
When I said that I've never seen reasonable assignment with a
hierarchy, it expressed exactly this distinction. Assignment is for
values, not for objects.

And guess what? You often need generics (templates, etc.) for value
types. Don't get rid of them yet. ;-)

> > Even with strings, you might want to share the strategy for character
> > encoding.
>
> I don't. String has a value, only this counts.

According to the above distinction, string is a value type.

> You claim that these values
> *semantically* cannot be assigned.

No. String can (and should) have assignment.
But its internal strategy for character encoding might not. It might
be replaceable (yes, we have references!), but the strategy object
itself is not necessarily assignable - and shouldn't be if it's class-
wide.

> Why should I *statically* know string bounds and encoding? Any reason?

You might simply want to. For example, to separate domains.
But you don't need to know and then you can have replaceable
strategies within a single string type.

> > Just a reminder - we are talking about:
>
> > X := Y;
>
> Remember, you have just allowed this, both are void *.

It is you who has introduced void* into this discussion. I have no
idea why.

> >> Your point was that I shall not do it publicly. But, may I dispatch
> >> privately?
>
> > Privately you can dispatch to your internal strategies to get
> > character conversions, buffers, etc.
>
> How? To dispatch you need a class, which you have just scraped.

Internal strategy can be a class. That's a good place for dispatch
(note: I use the term "strategy" from the OO design pattern with the
same name).

> >> Write an editor for such strings, store a string, send it over the network,
> >> do anything after uninstalling the compiler ...
>
> > Still don't see the problem.
>
> How to instantiate a template when the type is unknown?

You don't. What was the problem?

> >> What are you going to do if the endianess
> >> of Wide x n Character does not fit your machine?
>
> > And why should I bother with endianness here?
>
> Because of the number of possible permutations of the bytes in Wide x n
> Character. I presume that Character, Wide x n Character are pointers to ...
> mmm, don't know what. Anyway, have fun!

I still have no idea why you have introduced endianness into this
discussion.
What does it have to do with assigning class-wide types?

The concept of endianness is meaningful only for data marshalling
(when the data is in transit, not when it's stored), which is outside
of string itself. Again - "strategy" is the keyword here.

> >> Whatever pattern you use, you will have to deal with this number of
> >> cases.
>
> > Or I just delegate to locale and conversion library that is part of my
> > operating system.
>
> And to whom delegates the conversion library? (:-))

Why should I bother?
Does it bother you that the mechanics of writing to NFS file are
different from writing to FIFO pipe? Same Ada code can do both.

We have operating systems to provide services, right?

(Unless we write operating systems, that is. :-) )

> > On my system I can have LOTS of different locales:
>
> > $ locale -a | wc -l
> > 502
>
> > Do you really expect me to have 502 classes in my program just for
> > strings?
>
> Yes, if you wanted to prevent locales from mixing, if you wanted to deal
> with text orientation in different languages, if you wanted
> locale-dependent sorting etc. There must be a deep elaborated hierarchy I
> suppose.

Good luck, then. :-)

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




  parent reply	other threads:[~2007-05-30 20:52 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 [this message]
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
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