Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Perl 6 and Perl 5 parsing

by Anonymous Monk
on Jan 14, 2011 at 10:03 UTC ( [id://882317]=note: print w/replies, xml ) Need Help??


in reply to Re: 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 in Perl6? In a way so as long there is a BEGIN block isn't that impossible.

Replies are listed 'Best First'.
Re^3: Perl 6 and Perl 5 parsing
by masak (Scribe) on Jan 14, 2011 at 10:45 UTC
    Then whats the point in separating compile time and run time in Perl6? In a way so as long there is a BEGIN block isn't that impossible.

    In the general case it's impossible to "separate" compile time and run time, yes. In Perl 5 as well as 6.

    But please remember that BEGIN and &eval aren't there because one day we looked the other way and they just snuck in. They're there because sometimes we need them as escape hatches when what we want to do can't be done by less crude means.

Re^3: Perl 6 and Perl 5 parsing
by ikegami (Patriarch) on Jan 14, 2011 at 18:58 UTC

    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.

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://882317]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-03-28 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found