Created
September 26, 2019 09:04
-
-
Save lizmat/71c32456b5de3cab33a5a833f3a8ea6a to your computer and use it in GitHub Desktop.
Why do we need to create a Scalar for the Proxy object for each access / change ???
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/bootstrap.c/BOOTSTRAP.nqp b/src/Perl6/bootstrap.c/BOOTSTRAP.nqp | |
index 963db37eb..ffef42e48 100644 | |
--- a/src/Perl6/bootstrap.c/BOOTSTRAP.nqp | |
+++ b/src/Perl6/bootstrap.c/BOOTSTRAP.nqp | |
@@ -1739,14 +1739,10 @@ BEGIN { | |
Proxy.HOW.add_attribute(Proxy, BOOTSTRAPATTR.new(:name<&!FETCH>, :type(Mu), :package(Proxy))); | |
Proxy.HOW.add_attribute(Proxy, BOOTSTRAPATTR.new(:name<&!STORE>, :type(Mu), :package(Proxy))); | |
Proxy.HOW.add_method(Proxy, 'FETCH', ($PROXY_FETCH := nqp::getstaticcode(sub ($cont) { | |
- my $var := nqp::create(Scalar); | |
- nqp::bindattr($var, Scalar, '$!value', $cont); | |
- nqp::decont(nqp::getattr($cont, Proxy, '&!FETCH')($var)) | |
+ nqp::decont(nqp::getattr($cont, Proxy, '&!FETCH')($cont)) | |
}))); | |
Proxy.HOW.add_method(Proxy, 'STORE', ($PROXY_STORE := nqp::getstaticcode(sub ($cont, $val) { | |
- my $var := nqp::create(Scalar); | |
- nqp::bindattr($var, Scalar, '$!value', $cont); | |
- nqp::getattr($cont, Proxy, '&!STORE')($var, $val) | |
+ nqp::getattr($cont, Proxy, '&!STORE')($cont, $val) | |
}))); | |
Proxy.HOW.add_method(Proxy, 'new', nqp::getstaticcode(sub ($type, :$FETCH!, :$STORE!) { | |
my $cont := nqp::create(nqp::decont($type)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment