Comment Comment by b2gills The `but` keyword takes an instance and something to mix into it.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 ) } parent b2gills 5 years ago
So you can say something like this:
---Since `True` is a `Bool` it automatically creates a role that has a method `Bool` that returns `True`.
You can do that manually if you want. ---It creates a new subclass of Int and mixes in the role.
So:
Is roughly equivalent to: