The Perl 6 object system has a built-in mechanism for introspection, with which you can see what this particular object in hand can do, which class it is implementing, which methods can be used, and so on.
In the previous chapters, we already used one of the mechanisms of introspection—the WHAT method. It returns the type object with information about the type of the object that is located in the container now. We are talking about introspection in the chapter dedicated to the object-oriented programming, but you should keep in mind that in Perl 6, many other simple variables such as strings or integers are also objects.
For example, this is how you can see the type of a string and an integer. The program prints the stringified version of what the WHAT method returns:
say 'string'.WHAT; # (Str)
say 42.WHAT; # (Int)
With...