解釋器中的參數語法似乎有些不一致。我正在使用最新的Rakudo。請看下面的終端輸出:解釋器中的Perl 6函數參數語法(REPL)
$ perl6
To exit type 'exit' or '^D'
> say: "foo"
foo
> say("foo")
foo
> say "foo"
===SORRY!=== Error while compiling:
Two terms in a row
------> say⏏ "foo"
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier loop
>
$ perl6
To exit type 'exit' or '^D'
> say "foo"
foo
> say("foo")
foo
> say: "foo"
foo
> say "foo"
===SORRY!=== Error while compiling:
Two terms in a row
------> say⏏ "foo"
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier loop
>
$
看來你已經使用了「:
」或「()
」後提供的參數,你不能回去用「」,即空間,以供應參數。
還是我錯過了什麼?
謝謝!
lisprog
我之前做過類似的錯誤(請參閱[在Perl 6中使用方法和函數調用中的冒號](https://stackoverflow.com/questions/30982697/use-of-colon-in-method-andfunction -calls-in-perl-6)) –