Created
September 15, 2017 14:02
-
-
Save scovit/d4dc4bd73022a63c71bb2b500b543212 to your computer and use it in GitHub Desktop.
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
my $value := 42; | |
sub fetch($cont) { nqp::say("cuius"); $value } | |
sub store($cont, $new) { nqp::say("gratur"); $value := $new } | |
class SomeCont { } | |
nqp::setcontspec(SomeCont, 'code_pair', nqp::hash( | |
'fetch', &fetch, | |
'store', &store | |
)); | |
my $cont := nqp::create(SomeCont); | |
nqp::say(nqp::decont($cont) == 42); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment