Michal Wallace:
> I can store all my subroutine definitions in
> a list or something and then dump them out
> after the "__main__" routine. Is that the
> right approach? It seems strange to me,
> but I'm new at this.

That seems to be the way to do it, speaking as someone who's working on a
Perl 5-to-PIL converter (using the B optree-introspection modules).

The problem here is that .sub has meanings beyond just "here's a
subroutine".  .sub is actually a compilation unit, which complicates things
terribly.   You *could* just use branches and labels to create a new sub
without actually making a new compilation unit:

    .sub main
        ...
        branch mysub_after
    mysub:
        ...
        ret
    mysub_after:
        ...
    .end

But that makes imcc run slower, so I don't recommend it.

--Brent Dax <[EMAIL PROTECTED]>
Perl and Parrot hacker

Reply via email to