in reply to Re^2: Perl 6 and Perl 5 parsing
in thread Perl 6 and Perl 5 parsing

Then whats the point in separating compile time and run time

Speed. There's no reason to compile code every time it's executed. That would be very slow, and there's no advantages to doing it that way.

In a way so as long there is a BEGIN block isn't that impossible.

Not at all. It just prevents the compile-time of all code blocks from happening at the same time.

Replies are listed 'Best First'.
Re^4: Perl 6 and Perl 5 parsing
by moritz (Cardinal) on Jan 14, 2011 at 19:20 UTC
    Speed

    And consistency.

    Consider code like

    for (1..10) { # some statements # grammar modification here }

    If compile time and run time modification were not separated, the head of the loop would be once parsed without the grammar modifications, and then reparsed with grammar modifications - a nightmare for readability and debugging.

      I had mentioned code polymorphism in my reply, but I removed it before posting because code polymorphism can still occur with a single compile-time. Yes, it's nightmarish, but it's not a reason for separating compile-time.

        Yes, it's nightmarish, but it's not a reason for separating compile-time.

        Huh? A nightmare is not worth avoiding? Why is it no reason?