You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, to create an accessor using the mop, you need to do something like
$meta->add_method(
$meta->method_class->new(
name => $attr->key_name,
body => sub {
my $self = shift;
$attr->fetch_data_in_slot_for($self);
}
)
);
which is going to be noticeably slower than a handwritten method like method foo { $!foo } since it has to go through the mop for every attribute access, whereas slot access is cached when accessing attributes via twigil variables. We should figure out a way around this, maybe providing an attribute($self, '$!foo') keyword or something along those lines, which would compile down to something more like the actual twigil access. In the core, we may be able to get away with using actual twigils here too, but our current twigil implementation depends on being able to compile the surrounding method ourselves.
The text was updated successfully, but these errors were encountered:
Right now, to create an accessor using the mop, you need to do something like
which is going to be noticeably slower than a handwritten method like
method foo { $!foo }
since it has to go through the mop for every attribute access, whereas slot access is cached when accessing attributes via twigil variables. We should figure out a way around this, maybe providing anattribute($self, '$!foo')
keyword or something along those lines, which would compile down to something more like the actual twigil access. In the core, we may be able to get away with using actual twigils here too, but our current twigil implementation depends on being able to compile the surrounding method ourselves.The text was updated successfully, but these errors were encountered: