gpt4 book ai didi

raku - .wrap sub 后签名错误。

转载 作者:行者123 更新时间:2023-12-04 08:20:20 25 4
gpt4 key购买 nike

在我包装子之后,签名不接受包装前接受的捕获。

sub wr(:$a) {say $a};
my $sig-before = &wr.signature;
say $sig-before; # (:$a)
say %(:a(3)) ~~ $sig-before; # True

&wr.wrap(-> |c {callsame(c)});
my $sig-after = &wr.signature;
say $sig-after; # (:$a)
say %(:a(3)) ~~ $sig-after; # False
say %(:a(3)) ~~ $sig-before; # False

say $sig-before.WHICH, ' ', $sig-after.WHICH; # Signature|140466574255752 Signature|140466574255752
say $sig-before eq $sig-after; # True
say %(:a(3)).Capture ~~ $sig-after; # 'Cannot invoke object with invocation handler in this context'
say $sig-after.ACCEPTS(%(:a(3)).Capture); # 'Cannot invoke object with invocation handler in this context'

我在 Rakudo 代码中看到:
multi method ACCEPTS(Signature:D: Capture $topic) {
nqp::p6bool(nqp::p6isbindable(self, nqp::decont($topic)));
}

可能这是一个错误?或者我如何解决该行为,如果这是预期的,我如何在运行时理解我在具体情况下做了解决方法?

最佳答案

Probably it is a bug?



之前我将某些东西称为错误时我错了,但我会说其中存在错误,即使它只是一个 Less Than Awesome 错误消息错误。

我想 wrap比较少 roast tests (许多匹配是误报;在结果中搜索 wrap(wrap:)。如果您想使用 wrap,这里要做的一件关键事情是添加一个烘焙测试,涵盖我们希望它在此处执行的操作不正确(假设它不仅仅是一个 Less Than Awesome 错误消息)。

我认为 wrap 是最脆弱的官方 P6 功能之一:
  • new/open/stalled bugs in RT Perl 6 queue matching 'wrap' .
  • new/open/stalled bugs in RT Perl 6 queue matching 'Cannot invoke object with invocation handler in this context' .
  • open rakudo repo issues matching 'wrap' .
  • open rakudo repo issues matching 'Cannot invoke object with invocation handler in this context' .
  • 关于raku - .wrap sub 后签名错误。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52989863/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com