On 7/13/26 1:09 AM, ToddAndMargo via perl6-users wrote:
Hi All,
This is a fascinating answer I got back from Chat GPT:
-T
Chat GPT kept on talking after I thanked him:
One of the things I like about Raku is that its type system
is very introspective, so you can often ask an object about
itself. Here are a few other methods you may find useful
as you explore:
say $item.^name; # Type name, e.g. "Int"
say $item.WHAT; # Type object, e.g. (Int)
say $item.perl; # Reconstructable representation
say $item.raku; # Modern equivalent of .perl
say $item.gist; # Human-readable representation
And since you're building an array with mixed types, here's a neat
little debugging loop:
for @array.kv -> $i, $item {
say "[$i] {$item.raku} ({$item.^name})";
}
which might print:
[0] "hello" (Str)
[1] 42 (Int)
[2] Person.new (Person)
One more Raku feature that surprises people coming from other
languages: everything is an object. Even an Int, Str, Bool,
or Nil has methods and type information, so you don't need
special functions like typeof() or isinstance() from other
languages.
If you keep working with Raku, feel free to ask. It's a language
with a lot of elegant features that aren't always obvious at
first, and it's fun to explore them.