Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Need a solution to avoid circular imports
- #File ForPoint.rakumod
- unit Module ForPoint;
- #We cannot import ForLine here : circular problem
- #suppose we declare subbed Line here ok
- #but it is implemented into ForLine module which we may NOT import with use.
- #How can we proceed though?
- class Line {
- ...
- };
- class Point is export {
- has Int $.x;
- has Int $.y;
- has Line @belong;#Here is the problem.
- method new(Int $x,Int $y) {
- # bla bla
- }
- }
- #File Forline.rakumod
- unit Module ForLine;
- use ForPoint;
- class Line is export {
- has Point $.a;
- has Point $.b;
- method new(int-list $ia,int-list $ib,:$int-motif? = -1,:$motif? = ''){
- my Point ($a,$b,$origin,$destination) = bound_control($ia,$ib);
- self.bless( :$a, :$b,:$origin,:$destination,:$int-motif,:$motif);
- }
- method a {
- #bla bla
- }
- method b {
- #bla bla
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement