comp.lang.ada
 help / color / mirror / Atom feed
* Re: "Object" types vs. "Value" types
@ 1996-03-26  0:00 Jean-Pierre Rosen
  0 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre Rosen @ 1996-03-26  0:00 UTC (permalink / raw)


At 07:24 25/03/1996 -0500, you wrote:
>"1) "Value semantics" if Y:=X means that the contents of X is copied into Y.
>2) "Reference semantics" if Y:=X means that from now on, X and Y designate
>the same object."
>
>I think this can be a bit confusing, because it describes what are high
>level notions in terms of one particular implementation approach.
>
>Now of course, "as if" applies, so what is meant for example is that
>"Value Semantics" if Y := X means that it is AS IF the contents of X
> is copied into Y.
>
>[...] explanation of lazy assignment deleted
>
>The distinction is indeed critical, but no wonder you got confused talking
>about assignment if you immediately started talking about low level
>implementation details (use of pointers, and copying of values on
>assignment). You need to describe the difference at an operational
>semantic level, as I have done here, rather than at an implementation
>level.
>

Yes, of course, I was talking about abstract behaviour. Note that I
described it in terms  of *private* types (which is actually totally
irrelevant to the discussion), just to mean that I intended to described a
perceivable behaviour, not an implementation issue. That's also why I tried
to give an example of non-pointer reference semantics.

So the real issue is the abstract meaning of assignment. Note for example
that you can consider pointers as a "value" type (the value being the
designation of an object), or directly as a  "reference" type. Grossly, this
would be the  former case for a visible pointer type, and the latter for a
private pointer type.
+------------------------------------o-------------------------------------+
| P-mail:                            | E-mail: rosen@enst.fr               |
|   ADALOG - 27 avenue de Verdun     |    Tel: +33 1 46 45 51 12           |
|   92170 Vanves - FRANCE            |    Fax: +33 1 46 45 52 49           |
+------------------------------------o-------------------------------------+




^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: "Object" types vs. "Value" types
@ 1996-03-25  0:00 Jean-Pierre Rosen
  1996-03-25  0:00 ` Robert Dewar
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jean-Pierre Rosen @ 1996-03-25  0:00 UTC (permalink / raw)


At 01:31 20/03/1996 GMT, you wrote:

> [...]
>In light of these notions, I long ago came to the conclusion that, as
>far as programming was concerned, there was a useful distinction to be
>made between two sorts of data types: "object" types and "value"
>types. An "object" type is a data type for which the distinction
>between "identity" and "state" was strong, whereas a "value" type would
>lack this strong distinction.
>
> [lots of valuable stuff deleted]

This subject was raised at one of the  Ada-France meetings, when  Michel
Gauthier came and said "Hey guys, I don't know what an assignment statement
does". We told him "sit down, we'll explain to you". Two hours of discussion
later, nobody knew anymore how to define the semantics of assignment...

However, we came to the conclusion that there were two cases where the
semantics of assignment could be defined, and this is very close to what you
said.

Given a (private) type, and two variables X and Y, we say that the type has:

1) "Value semantics" if Y:=X means that the contents of X is copied into Y.
2) "Reference semantics" if Y:=X means that from now on, X and Y designate
the same object.

1) is for "usual" values, 2) is for pointers of course, but also any other
kind of reference (like the (private) type being actually a string used as
an entry in a symbol table).

Note that there is no syntactic way (without looking at the private part) to
tell which semantic a private type has : it has to be commented.

An important consequence of this finding is that you should never mix in a
record fields with "value" semantics and fields with "reference" semantics;
if you do, it is impossible to give a simple semantics to assignment for
objects of this record type.

The issue of limited types is a bit different. Limited types (and controlled
types) are useful when the predefined assignment would have the wrong semantic.

This issue is discussed at length in my book, and in several of Michel
Gauthier's publications (I don't have the reference at hand, but he will
tell you if you want).
+------------------------------------o-------------------------------------+
| P-mail:                            | E-mail: rosen@enst.fr               |
|   ADALOG - 27 avenue de Verdun     |    Tel: +33 1 46 45 51 12           |
|   92170 Vanves - FRANCE            |    Fax: +33 1 46 45 52 49           |
+------------------------------------o-------------------------------------+




^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Comments on generic stack?
@ 1996-03-15  0:00 Michel Gauthier
  1996-03-20  0:00 ` "Object" types vs. "Value" types John G. Volan
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Gauthier @ 1996-03-15  0:00 UTC (permalink / raw)


In article <4i6l2t$j1q@dmsoproto.ida.org>, wheeler@aphrodite.csed.ida.org
(David Wheeler) wrote:

>> [...]
>>  
>>  Below is yes, yet another implementation of an unbounded stack. This one
>>  supports assignment (:=), equality (=), and finalizes correctly, as
>>  well as supporting the tried and true Pop and Push operations.
>>  It's a generic that requires the Item to have := and =, but since the
>>  stack itself has those operations it is composable (you can have a
>>  Stack of Stacks of Integers).

Sorry to disturb, but I cannot understand what is a stack of stacks.

Stacks are designed to organise values, not objects. 
Stacks are objects, not values.
How can you define stacks of stacks ?

David probably means either stacks of (item=>references to stacks) or stacks of
(item=> some implementation of the stack abstract type with an initial algebra
behaviour). The latter actual type is an academic feature that has strictly no 
practical use.

----------          ----------          ----------          ---------- 
Michel Gauthier / Laboratoire d'informatique
123 avenue Albert Thomas / F-87060 Limoges
telephone +33 () 55457335 [or ~ 7232]
fax +33 ()  55457315  [or ~7201]
----------          ----------          ----------          ----------
La grande equation de la fin du siecle : windows-X = Mac-Y
The main end-of-century equation : windows-X = Mac-Y
----------          ----------          ----------          ----------
Si l'an 2000 est pour vous un mysticisme stupide, utilisez la base 9
If you feel year 2000 a stupid mystic craze, use numeration base 9
----------          ----------          ----------          ----------




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1996-03-28  0:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-26  0:00 "Object" types vs. "Value" types Jean-Pierre Rosen
  -- strict thread matches above, loose matches on Subject: below --
1996-03-25  0:00 Jean-Pierre Rosen
1996-03-25  0:00 ` Robert Dewar
1996-03-26  0:00 ` Michel Gauthier
1996-03-27  0:00   ` Richard A. O'Keefe
1996-03-27  0:00     ` Robert Dewar
1996-03-27  0:00 ` Michel Gauthier
1996-03-15  0:00 Comments on generic stack? Michel Gauthier
1996-03-20  0:00 ` "Object" types vs. "Value" types John G. Volan
1996-03-20  0:00   ` John DiCamillo
1996-03-21  0:00     ` Comments on generic stack? John G. Volan
1996-03-21  0:00   ` "Object" types vs. "Value" types david scott gibson
1996-03-25  0:00     ` John G. Volan
1996-03-28  0:00       ` david scott gibson

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