Hi,

According to synopsis 12 I could defer methods to methods in another object.
The case in which one can map some name into another didn't work out.
*
**
**class A {**
**  method say-i (Int $i ) { say "I: $i"; }**
**}**
**
**class B {**
**  has A $.n handles { :x<say-i> };**
**
**  submethod BUILD { $!n .= new; }**
**}**
**
**my B $b .= new;**
**$b.x(30);**
*

Error is
Method 'x' not found for invocant of class 'A'

OK, then I misunderstood it but when flipping the key value map in that particular line like so

*  has A $.n handles { :say-i<x> };*

Error is now
Method 'x' not found for invocant of class 'B'

Removing brackets from the first try works
*  has A $.n handles :x<say-i>;**
**
*As well as
*  has A $.n handles (:x<say-i>);**
*
Conclusion is that curly brackets for Hash does not work while Pair's do.
Hashes aren't tested either. See|S12-attributes/delegation.t| lines |65–80| <https://github.com/perl6/roast/blob/master/S12-attributes/delegation.t#L65-L80>

Greetings,
Marcel

Reply via email to