RE: [stack] Baker Papers
wtanksley@bigfoot.com — 2000-05-13 23:14:45
From:
srenner@... [mailto:
srenner@...]
>This is a reminder that Henry Baker' papers, collected at
>ftp://ftp.netcom.com/pub/hb/hbaker/home.html
>are very much worth reading.
I'll vouch for that. Some of them are very difficult going (such as
ThermoGC), but all of them are rewarding, and if a paper is too hard one can
always read other ones on the same subject, which will provide what may be a
better introduction (such as, in this case, ReverseGC).
>Today I am looking at "'Use-Once'
>Variables and Linear Objects -- Storage Management, Reflection and
>Multi-Threading".
Another good paper on this subject is the first one I ever saw which made
Forth look like a decent functional language: "Linear Logic: the Forth shall
be First." I would certainly recommend it to all on this list.
>All Joy objects are linear, since there are no
>references, only copies.
Really? I thought that Joy used references.
>sr
-Billy
srenner@mail.ru — 2000-05-14 02:27:41
> >All Joy objects are linear, since there are no
> >references, only copies.
>
> Really? I thought that Joy used references.
>
> >sr
>
> -Billy
Let me think. What does "dup" do? Doesn't it push a copy of the top
of the stack? Joy doesn't have variables which can appear in more than
one place. But it's late. Let us revisit the question tomorrow.
sr
Christian Tismer — 2000-05-14 12:19:52
srenner@... wrote:
>
> > >All Joy objects are linear, since there are no
> > >references, only copies.
> >
> > Really? I thought that Joy used references.
> >
> > >sr
> >
> > -Billy
>
> Let me think. What does "dup" do? Doesn't it push a copy of the top
> of the stack? Joy doesn't have variables which can appear in more than
> one place. But it's late. Let us revisit the question tomorrow.
DUP pushes a copy of the topmost stack element. But that's just
a number, an address or whatever.
If your top level element is a program, I'm pretty sure that
you will get another reference to that thing, not a copy.
ciao - chris
--
Christian Tismer :^) <mailto:
tismer@...>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship*
http://starship.python.net
14163 Berlin : PGP key ->
http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today?
http://www.stackless.com
srenner@mail.ru — 2000-05-14 15:18:13
> > one place. But it's late. Let us revisit the question tomorrow.
>
> DUP pushes a copy of the topmost stack element. But that's just
> a number, an address or whatever.
> If your top level element is a program, I'm pretty sure that
> you will get another reference to that thing, not a copy.
>
> ciao - chris
So either a. DUP == shallow-copy or b. DUP == deep-copy . Either or
possibly both. If both were correct then we would prefer a because
shallow-copy is cheaper. If a is correct then b is too, I think. But a
isn't correct.
1) P DUP == P P
Suppose we have a word which looks inside a quotation (program) and
modifies it. Let's see -- OK, the word is x and it looks inside the
quotation and DUPs the last word in the quotation.
2) [1 2 3] x == [1 2 3 3]
3) [1 2 3] DUP == [1 2 3] [1 2 3]
4a) [1 2 3] DUP x == [1 2 3] [1 2 3 3] (deep DUP)
4b) [1 2 3] DUP x == [1 2 3 3] [1 2 3 3] (shallow DUP)
In 4b, the quotation contains a pointer to a single list which is
modified. I would like to hear an argument in favor of shallow DUP.
sr