Luke Palmer wrote:

Could you just look through the lexical scope of the object?

    for $this.MY.kv -> $k, $v {
        print "$k: $v\n"
    }

Or would you look through the class's lexical scope and apply it to
the object?

    for keys $this.class.MY {
        print "$_: $this.MY{$_}\n"
    }

I think one of those two is possible. (Providing the .class method
exists and DWIMs)
I'm not sure either of those works, exactly. The scope of attributes isn't
precisely lexical in nature. Perhaps instead of a C<MY> method, an object
would have a (private!) C<HAS> method, allowing something like:

      for $this.HAS -> $attr {
          print "$attr.key(): $attr.value()\n"
      }

Or maybe not. ;-)

Damian

Reply via email to