Larry Wall wrote:
As a unary lazy prefix, you could even just say
s[pattern] doit();
Of course, then people will wonder why
.subst(/pattern/, doit())
doesn't work.
Another possibility: make it work. Add a "delayed" parameter trait
that causes evaluation of that trait to be postponed until the first
time that the parameter actually gets used in the routine. If it
never gets used, then it never gets evaluated. I could see uses for
this outside of the narrow scope of implementing substitutions.
--
Jonathan "Dataweaver" Lang