Perl 6 function argument syntax in interpreter (REPL)

There seems to be some inconsistencies in the argument syntax in the interpreter. I am using the latest Rakudo. See the following terminal output:

$ 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
> 
$ 

It seems that after you have used " :" or " ()" to supply arguments, you cannot return to using " ", that is, space, to supply arguments.

Or am I missing something?

Thank!!!

lisprog

+4
source share
1 answer

say: "foo"

This line does not call the subroutine say.

say, "foo" ( ).

, "foo" , , REPL, .

, Useless use of constant string "foo" in sink context.

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

, , say , , .

. Rakudo .

+9

Source: https://habr.com/ru/post/1681480/


All Articles