Golf and change of behavior: $ perl6 -e 'use NativeCall; class T is repr<CPointer> is export { sub new(size_t $n) returns T is symbol<malloc> is native { * }; }; T.new();' $ perl6 -e 'use NativeCall; class T {...}; class T is repr<CPointer> is export { sub new(size_t $n) returns T is symbol<malloc> is native { * }; }; T.new();' ===SORRY!=== Error while compiling -e Cannot change REPR of T now (must be set at initial declaration) at -e:1
Workaround: $ perl6 -e 'use NativeCall; class T is repr<CPointer> {...}; class T is export { sub new(size_t $n) returns T is symbol<malloc> is native { * }; }; T.new(); say T.REPR;' CPointer