(no title)
b2gills | 4 years ago
So you can say something like this:
0 but True
---Since `True` is a `Bool` it automatically creates a role that has a method `Bool` that returns `True`.
my $role = role { method Bool { True }}
You can do that manually if you want. 0 but role { method Bool { True }}
---It creates a new subclass of Int and mixes in the role.
So:
0 but True
Is roughly equivalent to: do {
my constant but-true = anon role { method Bool { True }}
my $class = anon class :: is Int does but-true {}
$class.new( 0 )
}
No comments yet.