I am trying to build a replacement for the existing Physics::Constants module, 
but running into problems when loading the pre-compiled version. I want to use 
code like:

unit module Physics::Constants;

use Physics::Unit;
use Physics::Measure;

constant \avogadro-constant is export(:DEFAULT, :fundamental, 
:avogadro-constant) = Measure.new(
  value => 6.02214076e+23, 
  error => 0, 
  units => 'mol⁻¹',
);

which compiles and runs quite well. However, when I try to run "mi6 test" which 
will precompile and then load the code, I get the following output:

$ mi6 test
===SORRY!=== Error while compiling 
/home/kevin/git/Physics-Constants/t/01-basic.rakutest
===SORRY!=== Error while compiling 
/home/kevin/git/Physics-Constants/lib/Physics/Constants.rakumod 
(Physics::Constants)
An exception X::Comp::AdHoc occurred while evaluating a constant:
Cannot unbox a P6opaque (NQPMu) type object
at /home/kevin/git/Physics-Constants/lib/Physics/Constants.rakumod 
(Physics::Constants):6
Exception details:
  ===SORRY!=== Error while compiling 
  Cannot unbox a P6opaque (NQPMu) type object
  at line 

at .../Physics-Constants/t/01-basic.rakutest:2
t/01-basic.rakutest .. Dubious, test returned 1
No subtests run

I am guessing that it can't deserialize the serialized Physics::Measure object, 
but I could be quite wrong.

Any ideas on how to make this work?

Thanks,

Kevin.

Reply via email to