On 12/31/2015 06:58 AM, Dave Rolsky via RT wrote:
I can confirm that this is still happening as of today's rakudo. It seems like 
an important bug to fix, but maybe more importantly, how are we supposed to 
handle circular deps? Consider a pair of classes, Tree and Node, which both 
need to refer to each other.

Tree.pm6
--------

unit class Tree;

use Node;

has Node $top;

--------

Node.pm6
--------

unit class Node;

use Tree;

has Tree $tree;
--------

Given that I have to use a module in order to refer to its type, this seems 
like a problem that will occur _way_ more often in Perl 6 than in Perl 5.

Often you can cope by not typing them in both modules . Then e.g. the node create method in the Tree module creates the Node object which receives the Tree object via the BUILD method. The Node module then does not have to import the tree module because all information is included in the Tree object just received. So the 'use Tree;' in Node.pm is not needed.



Reply via email to