Larry Wall wrote:
On Thu, Mar 19, 2009 at 02:18:35PM -0700, Darren Duncan wrote:
Yes, --> is the "of" type, not the "as" type, as S02 I think says.
Good to know.
Second, since the "sub NAME (PARAMS --> RETTYPE) {...}" form looks nice
visually, I would like to request a variant of that form, that flips the
arrow:
sub NAME (RETTYPE <-- PARAMS) {...}
Well, yes, that would be pretty, but the big problem with it is that
it's terribly ambiguous, given that the other-ended form can also
start with a type. (I can think of at least five mechanisms to force
it to work, but they're all pretty ugly when we're trying to maintain
a predictive parser outside of opererator precedence expressions,
which this isn't one of.) It's also getting just a little dicey to
provide a *fourth* way to do something when we already have three.
Maybe the problem is a technicality with the parser because ...
I'm guessing that the problem is that until you see the <-- then what you've
read so far on its left is ambiguous as to whether it is a result type or a
parameter. I can understand that but I don't know if its a big problem.
AFAIK the token <-- isn't used anywhere yet in Perl 6 and so its presence inside
a parameterized list would be unambiguous once you've read up to it.
Anyway, while I would appreciate if <-- worked, if it doesn't then I can live
with one of the existing alternatives ('of' being my current preference). This
is a "nice to have" but not something I would push as hard yet as some other issues.
Thank you. -- Darren Duncan