Question
How to forward declare a role to be used for an enum?
Running this piece of code
use v6.d;
role DrawSurface { ... };
enum Surface does DrawSurface <Fire>;
role DrawSurface {
method draw () {
given self {
when Surface::Fire { "f" }
}
}
}
Produces this error:
===SORRY!=== Error while compiling /tmp/me.raku
No appropriate parametric role variant available for 'DrawSurface':
Cannot resolve caller (Surface:U); Routine does not have any candidates. Is only the proto defined?
at /tmp/me.raku:5
How do I write that so that I can do this: Surface::Fire.draw
?
4 39
4