develooper Front page | perl.perl5.porters | Postings from August 2012

Re: junctions (was Re: fixing smartmatch just hard enough (and when, too))

Thread Previous | Thread Next
From:
David Golden
Date:
August 29, 2012 06:29
Subject:
Re: junctions (was Re: fixing smartmatch just hard enough (and when, too))
Message ID:
CAOeq1c85fLf4u6nPnWtYyWUwo3Yn41MCKAOOXzg9XLTt8d1fKA@mail.gmail.com
On Wed, Aug 29, 2012 at 8:48 AM, Nicholas Clark <nick@ccl4.org> wrote:
> What happens if we don't change that? ie that junctions are in @_, and
> a non-junction aware function is called? In what circumstances do things
> go wrong?

While it would be great if junctions were so native that they
distributed, assuming we can't do that in Perl 5, I think junctions
need to make it easier for people to map functions to the elements.
Then we need to teach people not to pass junctions to functions unless
those functions explictly expect junctions.

Effectively, we want to turn this:

    any( map { is_prime($_) } any(1,2,3)->values )

Into this:

    any(1,2,3)->map( \&is_prime )

I've submitted a Perl6::Junction ticket to that effect.

https://rt.cpan.org/Ticket/Display.html?id=79284

David

-- 
David Golden <dagolden@cpan.org>
Take back your inbox! → http://www.bunchmail.com/
Twitter/IRC: @xdg

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About