On Sat, 26 Aug 2000, Steven W McDougall wrote:
> However, the distinction between compile time and run time that it
> relies on doesn't exist in Perl. For example, if we chase through
> perlfunc.pod a bit, we find
No? I'll admit that it may run through the compile and run modes
multiple times, but that is still two modes.
>
> use Module;
>
> is exactly equivalent to
>
> BEGIN { require Module; import Module; }
> and
> require Module;
>
> locates Module.pm and does a
>
> do Module.pm
>
> which is equivalent to
>
> scalar eval `cat Module.pm`;
>
> and eval is documented as
>
> eval EXPR
>
> the return value of EXPR is parsed and
Parsed = compile-time
> executed as if it were a little Perl program.
Executed = runtime.
>
> Users can (and do) write open code in modules.
> There is nothing to prevent users from writing modules like
I don't understand. Do you think that needs to be prevented?
This is perfectly acceptable, (provided its what the user wanted).
>
> # Module.pm
> use Threads;
>
> Thread->new(\&foo);
>
> sub foo { ... }
>
>
> Users can also write their own BEGIN blocks to start threads before
> the rest of the program has been compiled
>
> sub foo { ... }
>
> BEGIN { Thread->new(\&foo) }
>
>
> Going in the other direction, users can write
>
> require Foo.pm
>
> or even
>
> eval "sub foo { ... }";
>
> to compile code after the program (and other threads) have begun execution.
>
>
> Given all this, I don't think we can sequester thread creation into
> "run time". We need a model that works uniformly, no matter when
> threads are created and run.
But all the above *is* runtime.
--
Bryan C. Warnock
([EMAIL PROTECTED])