On Sun, Aug 07, 2005 at 10:58:01PM +0100, Tim Bunce wrote:
> > The Container either has-a mutable cell, or has-a constant cell.
> > 
> >     my $mut = 3;
> >     my $con := 3;
> > 
> > Use ":=" to change the cell inside a container:
> 
> How about:
> 
>   Use ":=" to change the container to have a different cell.

That is correct.  Or "replace the cell".

> > Each cell has a Id.  Use "=:=" to check whether two containers have
> > cells of the same Id:
> > 
> >     $x =:= $y;      # false
> >     $x =:= $z;      # true
> 
> It's hard to imagine two "containers" both containing the same cell.
> The cell isn't really in two places at the same time.
> 
> What's missing from the description is that there's some form of
> 'pointer' from a container to the cell it currently contains.
> (I'm trying to avoid using the term reference.)

Yes.  The mutable has-a relationships are maintained with pointers.
I think the legend needs to be updated to reflect this fact.

> The description of the container model might benefit from making that
> pointer more explicit. It would help to clarify the action of the :=
> operator. (And =:= ?)

Right.  =:= is first retrieving the cells by chasing the pointer,
read the cell's id, and then comparing them.

> Please correct me if I'm laboring under too much perl5 baggage or
> confused in other ways.

No, your understanding is entirely sound.  The Container model is
basically a renormalized "glob" concept to apply also to lexical pads,
but with only one way to dereference the glob (i.e. the container),
instead of seven ways.

Hence, it looks like that it is indeed possible to rebind a variable
declared "is constant" to something mutable, just as this Perl 5
snippet does:

    our ($a, $b);
    *a = \3;
    $b = 4;
    *a = *b;
    print $a;   # 4

Compare with Perl 6:

    my $a := 3;
    my $b = 4;
    $a := $b;
    print $a;   # 4

Thanks,
/Autrijus/

Attachment: pgpHBFihaCzfs.pgp
Description: PGP signature

Reply via email to