Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created October 14, 2017 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/19825d7c42479982d27eeab33f0c3b01 to your computer and use it in GitHub Desktop.
Save zoffixznet/19825d7c42479982d27eeab33f0c3b01 to your computer and use it in GitHub Desktop.
zoffix@VirtualBox~/CPANPRC/rakudo (nom)$ ./perl6 -e 'int32.new: 42'
Cannot instantiate native type
in block <unit> at -e line 1
zoffix@VirtualBox~/CPANPRC/rakudo (nom)$ gd
diff --git a/src/Perl6/Metamodel/NativeHOW.nqp b/src/Perl6/Metamodel/NativeHOW.nqp
index 5d2a22e..70e3c68 100644
--- a/src/Perl6/Metamodel/NativeHOW.nqp
+++ b/src/Perl6/Metamodel/NativeHOW.nqp
@@ -113,6 +113,10 @@ class Perl6::Metamodel::NativeHOW
$!unsigned
}
- method method_table($obj) { nqp::hash() }
+ method method_table($obj) {
+ nqp::hash('new',
+ nqp::getstaticcode(sub (*@_,*%_) {
+ nqp::die('Cannot instantiate native type') }))
+ }
method submethod_table($obj) { nqp::hash() }
}
zoffix@VirtualBox~/CPANPRC/rakudo (nom)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment