in reply to Re: RunTime & compile Time Doubt on Perl
in thread RunTime & compile Time Doubt on Perl

The complete story is more complicated still, as perl is able to dynamically link to "Perl" libraries compiled from other languages, including C and C++.

But this is an aside. The problem in Perl is that certain operations can only be parsed completely in the run-time context.

Consider the following, for which C has no analog (buffer overflows notwithstanding).

my $str = $ARGV[0]; eval("use $str;");
Now, some theorists will complain bitterly that this must slow your code down, but this is usually the least of your problems. (See Optimising Perl.. for example)

Thog.

--
Dorothy Sayers is still correct.

Replies are listed 'Best First'.
Re: The complete story is more complicated,
by kscaldef (Pilgrim) on Dec 29, 2006 at 19:03 UTC
    "Consider the following, for which C has no analog"

    In that particular case, dlopen does provide an analog. In fact, sufficiently devious use of system() and dlopen() and friends can do what eval does. (Not that I would recommend this.)