>>>>> "AT" == Adam Turoff <[EMAIL PROTECTED]> writes:

>> Wouldn't just the appearance of *foo = \&other_foo, be enough to tell
>> the compiler to treat all foo's (or perhaps if there were some dataflow
>> analysis some region of code) to use indirection?

AT> You're forgetting eval "*foo = \&other_foo" and the like.  :-)

AT> And, if modules are threaded when they're bytecompiled, it's rather 
AT> difficult to intuit some random invocant's use of *foo = \&other
AT> (at runtime) to add the required indirection post hoc.

AT> Perl's expected behavior almost requires unthreaded bytecode.  Threaded 
AT> bytecode could work, if it's explicitly requested (thus making 
AT> *main::localtime = *foo = \&bar; a fatal error, at the user's request.)

I don't see it.

I would find it extremely akward to allow 

        thread 1:       *foo = \&one_foo;
        thread 2:       *foo = \&other_foo;

Rather, this style should be done via a variable indirection &{$foo}.

I don't see much of a speed hit. Until the *foo assignment is actually
done, all threading is directly to the body of &foo. When the *foo
assignment is done,

        copy the &foo body to a new location.
        replace the old &foo body with an indirection

(I believe this is atomic.)

And optionally, the indirection could be to a fixup routine, that would
adjust the caller to directly point at the new body.

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to