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

sub --> macro optimization

Thread Next
David L. Nicol
August 3, 2001 11:53
sub --> macro optimization
Message ID:


while discussing fortranesque three-way comparative operators,
I imagined what I believe may be a workable syntax for differentiating
an in-place replacement from a callable subrouting, for Perl.


Instead of introducing a new keyword, have any sub consisting of
only one expression get replaced in the op tree with that expression,
instead of a subroutine-calling mechanism.  Complex in-place-expandables
could be implemented with

	sub foo{ do {

Possible problem:

redefinition of routines. The inline-expanded routine name could either 
maintain a list of everywhere it appears in the op tree, for
rereplacement, or the in-place replacement optimization could only happen
when we are certain that *foo isn't going to get assigned to from
any coderefs.

                                           David Nicol 816.235.1187
free Dmitry Skylarov

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