develooper Front page | perl.perl5.porters | Postings from July 2011

RFC: \. and \[.] prototypes

Thread Next
From:
Father Chrysostomos
Date:
July 10, 2011 13:55
Subject:
RFC: \. and \[.] prototypes
Message ID:
916B4694-59A7-4E64-95B5-BC3CCA38F14E@cpan.org
Currently there is no way to override keys and push with custom functions that behave the same way, because mykeys(%foo) and mykeys(\%foo) are indistinguishable with the (+) prototype. Also, the (+@) prototype for push is wrong, as push doesn’t accept hashes.

So I would like to propose a new \. prototype, which can also be used in \[whatever]: It will accept any scalar expression, take a reference to the result, and pass that to the function. Then push and keys can be emulated like this:

mypush(\[@.]@);
mykeys(\[@%.]);

This is also getting in the way of &CORE::keyword.


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