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

A wacky idea: "attributes" on builtins

Thread Next
John L. Allen
March 16, 2001 10:56
A wacky idea: "attributes" on builtins
Message ID:

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?


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