Skip Menu |

This queue is for tickets about the Syntax-Keyword-Junction CPAN distribution.

Report information
The Basics
Id: 95265
Status: new
Priority: 0/
Queue: Syntax-Keyword-Junction

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

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



Subject: Consider implementing overloaded mathematical and string operations
Let's say we want to see if any of $a, $b, or $c are even numbers. Right now, this can be done with: if ( any($a % 2, $b % 2, $c % 2) == 0 ) { ... } But it would be nice if this worked: if ( any($a, $b, $c) % 2 == 0 ) { ... } It works in Perl 6: perl6 -e'my ($a,$b,$c)=(1,2,3); say !!(any($a, $b, $c) % 2 == 0)' The basic idea would be that when a mathematical or string operation is performed on a junction, a new junction is returned of the results. any(1, 2, 3) * 2 ====> any(2, 4, 6) The tricky bit comes when you get an operation on two junctions: any(1, 2, 3) * any(2, 3) ====> any(2, 4, 6, 3, 6, 9) The latter result could be "optimized" to any(2, 4, 6, 3, 9).