Trey Harris wrote:
Might I propose the following normalization:

1. .call, method definition call(), and .wrap call all take captures.

2. .call() and both types of call() all pass on the arguments of the
   current subroutine.

> 3. To call with no arguments, use .call(\()) and call(\()).

I have no problem with that, but the original form should probably exist too. I don't know if that's called invoke or what, but something that takes an arglist and constructs the capture to pass on would be very helpful to most users.

4. Introduce some syntax for getting a capture of the current argument
   list explicitly.  Perhaps $?ARGS or $?_ or $?CAPTURE.  One shouldn't
   have to choose between repeating your 20 parameters in order to take a
   capture of them, and eliminating your nice self-documenting 20
   parameter names so you can use the easy \$arglist trick.

I like the idea in 4, even though I'm not sure that I follow the rest of your logic. Having access to a variable that contains the current argument list called $?ARGS seems to be in line with the rest of the $? state variables that are provided.

So, in general, I think the only thing missing is something like invoke so that:

        invoke(1,2,3);

is identical to:

        call(\(1,2,3));

and:

        invoke([,] =$?ARGS);

is identical to:

        call($?ARGS);

is identical to:

        call();

Certainly a distinction on call vs call() is not what Perl 6 programmers will come to expect from the rest of the language, and I see no pressing reason to introduce it here.

Reply via email to