Jon Lang wrote:
And AFAIK the token --> is used in exactly one place in perl 6: within
signature syntax, to mark the transition from the parameter signature
to the "return type" signature. As with Darren, I don't see why this
would be a big problem. The biggest stumbling block that I can think
of is that a return type cannot have an invocant, whereas the
parameter signature might be able to have one. May I inquire as to
the nature of the complications that I'm missing, for my own
edification? (If you can't afford the time, I'll understand.)
Unless there is some rule that an invocant has to be at the start of the
parenthetical routine signature list, I don't see a problem.
So we just have for example:
sub myfunc (Int <-- Int $self: Int $other) {...}
In fact I would expect any invocant to be after the <-- since it is really just
a parameter.
Spitballing here: you drew an analogy to the feed operators. I wonder
if that analogy could be taken further: use --> and <-- outside of
signatures as feed operators - but instead of feeding arrays back and
forth, have them feed capture objects and engage in some implicit
currying. That is:
foo <-- $capture
$capture --> foo
would both be equivalent to:
foo :assuming(|$capture)
...or something to that effect. So instead of composing a series of
functions by nesting them in each others' argument lists, you could do
so by chaining them together using --> or <--.
That could be interesting. But do you have an example use case or example code
illustrating its use?
As for the idea I raised to support <--, I have gone ahead anyway and designed
it into my cross-breed of Perl 6 and SQL called Muldis D (as of v0.62.2), as
"the" way of declaring a routine, rather than one of 4 ways. See the following
url for a bunch of example routine signatures demonstrating it:
http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Core/Routines.pod
At the same time I revamped my routine declaration format in other ways, and as
you can see this aspect of Muldis D now looks so much like Perl 6 they might be
indistinguishable at a glance, or regardless I think it can serve as reasonable
examples of how Perl 6 itself could look.
-- Darren Duncan