4

I found out something I cannot explain, so I golfed it to what I think is the bare minimum:

# file OurTest.rakumod
unit module OurTest;

use NativeCall;

our $our-errno is export := cglobal('libc.so.6', 'errno', int32); # note the "our"
# file test.raku
use NativeCall;
use lib '.';
use OurTest;

my $my-errno := cglobal('libc.so.6', 'errno', int32); # note the "my"

say $my-errno.^name;   # output: Int
say $our-errno.^name;  # output: Any

Why do the variables declared as my and our seem to contain different type of data?
No hint of that behavior in the documentation, this was unexpected to me.

Fernando Santagata
  • 1,487
  • 1
  • 8
  • 15
  • Might it be to do with the fact the cglobal returns a Proxy? – Scimon Proctor Feb 25 '20 at 15:32
  • Note in particular both "As explained, the issue here is not specific to export." and also "We certainly could warn that binding to an `our` variable is pointless use of `our`." in a comment on the answer of the SO this one duplicates. – raiph Feb 25 '20 at 15:41

0 Answers0