This is not the result of the Perl 6 built-in function, but rather the XML::Rabbit module.
This module provides the is xpath attribute and ensures that during the compilation of a class, any attribute that applies this attribute receives its access method, overridden with a custom one.
The user access method calculates and sets the value for the attribute on the first call, and on subsequent calls, it simply returns the value already stored in the attribute.
The user access method is implemented as follows (taken from the source code of the module with details):
method (Mu:D:) { my $val = $attr.get_value( self ); unless $val.defined { ... $val = ...; ... $attr.set_value( self, $val ); } return $val; }
Here $attr is the Attribute object corresponding to the attribute, and was retrieved before the method was installed using the Metaobject Protocol (MOP) .
The Data::Dump::Tree module, in turn, does not use the accessor method to retrieve the attribute value, but reads it directly using the MOP.
Therefore, he sees the value of the attribute as Nil , if it is not already set, because the accessor has not yet been called.
source share