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: 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 Mutable cells has-a mutable scalar value. Use "=" to change its value: $mut = 5; # works Constant cells has-a immutable scalar value. You cannot change it: $con = 6; # error Each cell is declared to be "is Tieable" or not tiable when it was allocated; you cannot change tieableness at runtime. my $nvar; my $tvar is Tieable; Tieable cells may be tied or untied. Use "tie" to tie a tieable cell: tie($tvar, SomeClass, some_param => 1); Non-tieable cells may not be tied. However, "untie" always works: untie($tvar); # works untie($nvar); # no-op That's about it. :-) Hopefully my two questions will make more sense to you now... Thanks, /Autrijus/
pgp49c9iDshl5.pgp
Description: PGP signature