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

RFC: &CORE::keyword

Thread Next
Father Chrysostomos
July 10, 2011 13:53
RFC: &CORE::keyword
Message ID:
This has been brought up a couple of times and no-one objected. But it was only mentioned in passing, so I thought maybe I should ask this directly:

Is this a feature we want?

I think so, as it allows core functions to be renamed:

*peruse = \&CORE::read;

And it allows one to write some things more concisely:

select undef, undef, undef, $interval;
&CORE::select((undef)x3, $interval);

OK, that only saved 2 chars, but you get the idea. :-)

Here’s a better example:

# Old style (I actually have code like this):
sub mytied(\[%@*$]) {
   ... do something special ...
   use Scalar::Util 'reftype';
   my $arg = shift;
   my $reftype = reftype $arg;
   if($reftype eq 'GLOB') {
       return tied *$arg;
   elsif($reftype eq 'ARRAY') {
       return tied @$arg;
   elsif(...) {

# New style:
sub mytied(\[%@$*]) {
   ... do something special ...
   return &CORE::tied($_[0]);

I’ve already started working on this.

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