develooper Front page | perl.perl5.porters | Postings from March 2001

A wacky idea: "attributes" on builtins

Thread Next
From:
John L. Allen
Date:
March 16, 2001 10:56
Subject:
A wacky idea: "attributes" on builtins
Message ID:
Pine.SOL.3.91.1010316135308.4553A-100000@gateway.grumman.com

Is there any way the attribute syntax could be hijacked/abused to
provide a backward-compatibility-friendly way of extending builtin
functions?  I'm thinking of something like this

        $usecs = time:milli();

This would allow the functionality of time() to be arbitrarily extended
without worrying about breaking old code.  I guess it would be sort of
like treating the 'time' sub as a kind of poor man's package, where the
"attributes" are more like a different kind of argument than separate
subroutines.  Well, maybe that metaphor sucks, but I do think the idea
has some (non-zero) merit.  How would the "attributes" be passed?  I
don't know - that's for smarter people to decide.  Comments?

John.

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