Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 105291
Status: new
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Define an eventual API for requesting the custom-op versions of any/all/none/etc...
Download (untitled) / with headers
text/plain 1.2k
In our nice shiney post-5.16 world, we can define custom operators; many of the S-L-U functions would benefit from these. All of the functions in Scalar::Util and Sub::Util can just be transparently implemented as operators in 5.16+; the caller doesn't need to be aware of the. However, many of the List::Util functions take a control block, whose behaviour would be significantly changed if this were done without the user's explicit agreement. Most notably, such cases as ( sub { any { return 1; } (); print "A custom-op implementation does not reach this line\n"; )->() causes the print to be skipped on a custom-operator implementation of any. We therefore need to define an interface by which callers can (hopefully lexically) explicitly request the custom-op version of these functions. Also thought should be given to allowing a three-way case, to allow most code to continue to function pre-5.16, where custom ops aren't available. * (default) function-based implementation * allow a custom-op or fallback to (&@)-prototyped function on pre-5.16 * require a custom-op; implicitly requiring 5.16 at all, as this must fail on older perls. [copied from https://github.com/Scalar-List-Utils/Scalar-List-Utils/issues/18] -- Paul Evans
Download (untitled) / with headers
text/plain 218b
Thought 1: import tags: use List::Util qw( :allow-op any all ); use List::Util qw( :must-op any all ); Thought 2: different packages: use List::Util::AllowOp qw( any all ); use List::Util::Op qw( any all );


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.