Perl 6:maxpairs 警告未定义值的字符串化

Perl 6: maxpairs warns about stringification of undefined values

看起来 maxpairs 不喜欢在具有未定义值的列表上调用:

> my @foo; @foo[2] = 4; say @foo.maxpairs;
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at <unknown file> line 1

(2 => 4)

max 没有同样的问题,似乎只是忽略了未定义的值:

> my @foo; @foo[2] = 4; say @foo.max;
4

同样的错误发生在:

> my @foo; @foo[2] = 4; say @foo.pairs.max(*.value)
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at <unknown file> line 1

2 => 4

所以看起来未定义的值只有在使用 max 没有过滤器参数时才会被忽略。

这是一个错误吗?

因为这看起来像是一个错误,我已经用

修复了它
https://github.com/rakudo/rakudo/commit/7bf7a2c6f83a57713c

它还负责 "minpairs"。