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

sub --> macro optimization

Thread Next
From:
David L. Nicol
Date:
August 3, 2001 11:53
Subject:
sub --> macro optimization
Message ID:
3B6AF0EE.FB50023B@kasey.umkc.edu


Introduction:

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.

Idea:

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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About