[I'm going to be a little pedantic here because I think it's worth it
given the need for clarity.]

On Sun, Aug 07, 2005 at 12:55:53AM +0800, Autrijus Tang wrote:
> On Sat, Aug 06, 2005 at 12:43:13PM -0400, Matt Fowles wrote:
> > The pictures are pretty and the compilation one makes a great deal of
> > sense, but I must admit to being enitrely confused by the container
> > one.  I think part of the problem is that I don't have a good footing
> > from which to understand it.  Is there somewhere I can look for a
> > gentle explanation of the whole container/tied/untied thing?
> 
> Hm, I'm afraid there are not much material on this beyond the Synopses,
> so I'll try to describe that picture a bit.
> 
> First off, all the lines you see are "has-a" relationships.  To wit:
> 
> Pad has-a Scalar Container that you can look up with "$name".
> 
>     my $name;
> 
> 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.

because "change the cell" could be misleading. The cell itself
isn't modified.

This is (I presume) essentially the same this Perl 5 snippet:

        $mut = 3;
        *mut = \3; # change the SCALAR slot in the GLOB called 'mut'

>     my $x = 3;
>     my $y = 4;
>     my $z = 5;
>     $x := $y;   # $x and $y now contain the same cell
>     $x := $z;   # not anymore; $x now shares the cell with $z
> 
> 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.)

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 =:= ?)

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

Tim.

Reply via email to