Nathan Torkington wrote:
> Perl6 RFC Librarian writes:
> > It is proposed that in a list context, operators are applied
> > component-wise to their arguments. Furthermore, it is proposed that
> > this behaviour be extended to functions that do not provide a specific
> > list context.
>
> I don't mind making Perl's builtins do this.  Making my own functions
> do it gives me the willies.
>
> You'd require subroutine authors to label their subroutines as capable
> of having this rule applied.  Subroutine users are still going to have
> to read the docs to work out how to use the subroutine.  You're not
> really making anything automatic, just trading one set of typing for a
> different set.
>
> Context is weird enough without trying to add more magic to it.  Stick
> with "make Perl's builtin operators apply themselves to list elements
> when in list context".
>
I know what you mean. I'm not crazy about it myself. However, it seems like
it shouldn't be necessary to explicitly incorporate this feature into all
Perl functions.

Maybe we could add an attribute: 'listable', 'loop', ...? This attribute
would be required to get the implicit looping behaviour in a list context.
Then Perl functions could use this attribute to get the behaviour
automatically, as could module authors who took the time to think about it.
This would follow the mind-set of the lvalue attribute quite closely.


Reply via email to