Replies: 3 comments
-
A core implementation might use a new op for this as well, or it might roll some (or all) of the behaviour into At least initially it's probably best to just go with a new op type. That means no existing code pays any performance penalty for these new operations. It might eventually make sense to fold it into the more general argument setup code that entersub will end up doing, or whatever else happens with the "no-snails" idea. |
Beta Was this translation helpful? Give feedback.
-
What does the word "compatible" mean? The following?
I afraid the addition of performance cost. |
Beta Was this translation helpful? Give feedback.
-
Current Implementation (2022-08-17)The first op within a method CV's optree is an The
Field BindingsThis final operation is the core of what makes field accesses work within methods. Every Each association is saved onto the savestack so that on stack unwind the pointers can be removed again. Because fields are stored as real SV pointers in the pad of a method, any nested closures can continue to capture them by the usual operations. Thus, code such as the following will work as expected: class Counter {
field $count;
method make_incr { return sub { $count++ }; }
} When the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Where should the code that runs at the start of every method actually live?
The tasks it has to perform:
$_[0]
is an reference to a compatible object instance$self
lexicalIn
Object::Pad
this is performed by a new (custom) op calledmethstart
.Beta Was this translation helpful? Give feedback.
All reactions