Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: Pre-compiled Perl?

by Anonymous Monk
on Apr 05, 2017 at 00:50 UTC ( [id://1187057]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Pre-compiled Perl?
in thread Pre-compiled Perl?

I don't think we have any real disagreement except for terminology. A compiler translates one formal language to another. If you define the parse tree to be a language, your definition of "language" is loose enough that every data structure is a language, and that makes every program a compiler. Saying that a language is "compiled" in the old-school sense really means that it is "compiled to machine language," but as you say, the distinction is mostly unimportant these days.

Contrary to some other languages (e.g. shell, TCL, awk, makefile), Perl has clearly a compile phase and a run time phase.
All of those languages have to be parsed, so they clearly have a "parse phase." The thing about Perl is that it lets you execute Perl code during the parse. Off the top of my head, I can't think of any other language that lets you do that.

Replies are listed 'Best First'.
Re^5: Pre-compiled Perl?
by LanX (Saint) on Apr 05, 2017 at 23:43 UTC
    > The thing about Perl is that it lets you execute Perl code during the parse.

    What do you mean?

    Macros are executed during the parse and LISP is one of the two oldest higher order languages and often copied.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      What do you mean?

      I guess it is the fact that files loaded via use are compiled and executed whilst parsing the loading file.

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
        Afaik does a require in Ruby also execute the code, and while not being an expert in Python it was easy to find the function __import__() which is executed at import. °

        I'd rather say execution at import is the rule and not the exception for dynamic languages.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        footnotes

        °) just checked it, no difference in Python, just see Why is Python running my module when I import it

      Macros are executed during the parse and LISP is one of the two oldest higher order languages and often copied.
      Hm. Obviously I haven't thought my statement through all the way. LISP can be completely parsed without executing any code; Perl can't.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found