With some recent PCT-related changes I think we may want to
update the tutorials a bit.
1. Remove the custom "List" class.
ResizablePMCArray now has built-in shift/unshift/push/pop
methods, so we can use it directly from NQP and don't need
to create a custom List class to be able to invoke these
operations.
2. Remove :scope attribute from PAST::Var nodes.
My intent has been that most PAST::Var nodes for simple variables
would not require individual scope attributes; with the changes
I checked into Parrot tonight this should be easier. In Squaak's
case this means that the C<identifier> action method should now
read:
method identifier($/) {
make PAST::Var.new( :name($name),
:viviself('Undef'),
:node($/) );
}
In particular, note that there's no longer a need to
explicitly search outer blocks for the scope -- PCT
will handle this automatically.
To indicate that all undeclared variables should default
to 'package' scope, we use the C<symbol_defaults> method on
the top-level block. For Squaak, we add the following to its
TOP action method:
$?BLOCK.symbol_defaults(:scope('package'));
This says that 'package' scope is to be used for any PAST::Var
node that doesn't have its own :scope and that doesn't have a
scope provided by an outer block's symbol hash.
3. (Bonus problem) Eliminate @?BLOCK
Since PAST::Var nodes no longer need to search outer blocks
(PCT will handle that), we no longer need to maintain a @?BLOCK
array. So, for bonus points, eliminate @?BLOCK from the Squaak
methods.
If I can help explain or demonstrate any of the above, let me know.
Thanks!
Pm