True, I didn't mention eval. At least in the case of the "optimized C" back end, I should have. Programs that use eval and want to use this back end would still need to link to perl.dll or perl.so to run. Also, there may be other features of Perl impractical to translate without relying on perl.dll/perl.so

As for Perl bytecode requiring a run time interpreter to execute the bytecode, so does Java bytecode.

As for "run time side effects", I mean does a BEGIN block perform an action that only makes sense at run time.

For example, suppose there's a Expect::Quick module and you use it like:

use Expect::Quick Prompt => [ -re => '^\$\s+' ], REMOTE => 'user@examp +le.com'; send 'command param1 param2'; my $resp = before; ...;

The implicit BEGIN block:

BEGIN { require Expect::Quick Prompt; import Prompt => [ -re => '^\$\s+' ], REMOTE => 'user@example.com' +; }

will create Expect obj, open a connection to example.com and login as "user".

If you saved the bytecode then load and run it later, the connection to example.com will not be done.

On the other hand:

use Expect::Quick; connect Prompt => [ -re => '^\$\s+' ], REMOTE => 'user@example.com'; send 'command param1 param2'; my $resp = before; ...;

could be compiled and the bytecode saved. Then later, when loaded and run, it would work correctly.

The dynamic features of Perl would still be available to use.

Of course, it is possible for the actual connect and login to be deferred until the first time send is called. My point is that import would have to be written to do that. And any other BEGIN blocks, implicit or not, could not perform actions that need to be performed at run time. But any and all of Perl's compile time magic is still "in play".


In reply to Re^6: What is an ordinary statement? by RonW
in thread What is an ordinary statement? by ntj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.