Perl6标准语法相对较大.虽然这有助于一旦掌握了表达,但它创造了掌握的障碍.例如,核心构造通常具有支持不同编程范例的多种形式.一个基本的例子是用于创建
Pairs的各种语法:
Pair.new('key','value'); # The canonical way 'key' => 'value'; # this... :key<value>; # ...means the same as this :key<value1 value2>; # But this is key => <value1 value2> :foo(127); # short for foo => 127 :127foo; # the same foo => 127
请特别注意第一种形式的评论:“规范方式”.
另一个例子是the documentation for method make
:
This is just a little sugar for $/.made = $ast which is a very common operation in actions.
是否存在可以为Perl6程序输出的规范形式,以便在掌握了规范子语法后,可以检查该形式的任何Perl6程序以理解它?