Perl6中方法声明中加号的含义是什么?
这里是spec的示例
submethod BUILD (+$tail, +@legs, *%extraargs) {
$.tail = $tail;
@:legs = @legs;
}
+@foo
中的*@foo
和my answer to the SO question "variable number of arguments to function/subroutine"。[Larry Wall在2015年推出了+
parameter prefix,这是表示+
的四个参数前缀(*
,**
,+
,|
)之一。他将其添加到Rakudo编译器中,添加了一些测试,给出了slurpy (variadic) parameters,并向相关的语言设计文档中添加了a brief informal description of it on the irc channel。
+
。如今,我们为此使用a named parameter as contrasted with a positional one,因此::