Out of curiosity, might there be any convenient way to support
heredoc parameters in PIR function calls?  (I suspect the answer
is "no", but thought I'd ask just in case.)

Currently PGE builds code to be compiled by emitting a sequence
of function calls, each call appends another line of output to a 
string pmc.  Of course, each of these calls takes some amount of
overhead, and it might be nice if instead of writing

    emit(code, "    lastpos = length target")
    emit(code, "    gpad = new PerlArray")
    emit(code, "    rcache = new PerlHash")
    emit(code, "    captscope = mob")
    emit(code, "    bsr %s", label)
 
one could instead write:

    emit(code, <<"CODE", label)
        lastpos = length target
        gpad = new PerlArray
        rcache = new PerlHash
        captscope = mob
        bsr %s
    CODE

thus converting the five emit statements into one.  Yes, I know I can do

    $S0 = <<"CODE"
        ...
    CODE
    emit(code, $S0, label)

but I'm not a fan of writing the $S0 variables -- they seem to distract
the code.  I may just go with something like

    code .=    "    lastpos = length target"
    code .=    "    gpad = new PerlArray"
    code .=    "    rcache = new PerlHash"
    code .=    "    captscope = mob"
    emit(code, "    bsr %s", label)

which at least changes the first four to be parrot ops instead
of function calls for each.

Any other thoughts or suggestions?  

Pm

Reply via email to