[comp.lang.eiffel] Functions without side eff

Kai_Henningsen@ms.maus.de (Kai Henningsen) (06/18/91)

William F Ogden ogden @ seal.cis.ohio-state.edu schrieb am Do 06.06.1991,
23:05

WF>As it turns out, referencs semantics are fine -- provided you only allow
WF>_one_ reference to each object. (With this constraint, you effectively
WF>have value semantics, of course.) Now the problem, rephrased in these

Has anybody ever considered mirroring this as a language construct? Probably
not too clear :-)

What I mean is, differentiate between "primary" and "secondary" references,
with the semantic that secondary references allow only read access to whatever
they reference - of course that would have to be enforced somehow.
Then, you might constrain the system to only one reference at a time, more to
be created via clone operations.

Hmmm. As I think of it, you could even do what modern implementations of fork()
(another expensive directive) does, and implement copy-on-write techniques. You
would have to keep book on whether an object reference is currently modifiable
or copy-on-write, of course.

That might even be *more* effective, as you could clone only as much as
absolutely needed ...
--
Kai Henningsen  Internet: kh@ms.maus.de
Muenster         UUCP: any_backbone_that_knows_domains!ms.maus.de!kh
Germany         Fido: kh%maus ms, 2:242/2.6 or Kai Henningsen, 2:242/2.244

Kai_Henningsen@ms.maus.de (Kai Henningsen) (06/22/91)

William F Ogden ogden @ seal.cis.ohio-state.edu schrieb am Mo 17.06.1991,
15:34

WF>|Just to add another vision of Stack :-), mine has two operations
WF>|        Push : Stack x Value -> Stack
WF>|        Pop  : Stack -> Stack x Value
WF>|where calls are denoted via equations, and updates via 's (a clumsy
WF>|syntax, admittedly).  Then the usual procedural Push is
WF>|        S' = Push(S,v),
WF>   ...
WF>Boy this version looks like it would involve a lot of gratuitous
WF>stack copying.

If you implement the stack as a list - none at all. Or use reference semantics.
--
Kai Henningsen  Internet: kh@ms.maus.de or kaih@math.uni-muenster.de
Muenster         UUCP: any_backbone_that_knows_domains!ms.maus.de!kh
Germany         Fido: kh%maus ms, 2:242/2.6 or Kai Henningsen, 2:242/2.244