在使用 NCurses 模块时,我遇到了一些奇怪的行为,我在 repl 中将其归纳为:
> my $c = ' '.ord
32
> $c.WHAT
(Int)
> my int32 $n = ' '.ord
32
> $n.WHAT
Bytecode validation error at offset 128, instruction 20:
operand type 32 does not match register type 24 for op getlex_ni in frame <unit>
> my int32 $m = 32
32
> $m.WHAT
Bytecode validation error at offset 128, instruction 20:
operand type 32 does not match register type 24 for op getlex_ni in frame <unit>
> my int32 $j = int32( 32 )
Cannot invoke this object (REPR: P6int; int32)
in block <unit> at <unknown file> line 1
Run Code Online (Sandbox Code Playgroud)
问题是 wborder 的签名是 (NCurses::WINDOW, int32, int32, int32, int32, int32, int32, int32, int32 --> int32) 但我没有尝试想出一个 int32 版本的32 已经工作了。我确定我错过了一些东西,但我不知道是什么。