4
Perl6标准语法比较大。尽管一旦掌握了这种表达方式,它就会形成一个掌握障碍。例如,核心构造通常具有支持不同编程范例的多种形式。一个基本的例子是创建Pairs各种语法:是否有Perl6规范形式?
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程序理解它?
'make'不是真的糖,它只是一个正常的方法和子程序。 –