Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

  (email not shown publicly)

Journal of autrijus (1505)

Saturday August 06, 2005
12:49 PM

Day 180 (r6092): Pretty pictures!

[ #26144 ]
As I'm moving forward with the new PIL runcore, I'm now trying to document my understanding as visual diagrams. Today I produced two:

While the first one is (I hope) self-explanatory, the second one requires some explanation. All the lines in it are has-a relationships; 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 tieable 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 for today. I hope you enjoy the pictures. :-)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.