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

RFC: \. and \[.] prototypes

Thread Next
Father Chrysostomos
July 10, 2011 13:55
RFC: \. and \[.] prototypes
Message ID:
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:


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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About