While I approve of this RFC, there are a few places where
it proposes (unnecessary) new primatives. Most of these
already exist or have planned names (in perl5).
--- Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote:
[snip]
> =item 2
>
> The Thread module should add a C<global> keyword or
> function that explicitly
> accesses a variable in the program-global stash.
in perl5, this would (or should) be written as
our $foo : shared;
>
> C<global $main::foo = $foo; # Let another thread
> know what my $foo is.>
> C<global $main::foo = \$foo; # Share my local foo.
> Dangerous!>
> C<$foo = global $main::foo; # Localize this instance
> of $main::foo.>
>
> Rationale: There needs to be some way to distinguish
> between the program-
> global stash and the thread-global stashes. It should
> undeniably mark the
> data that is being shared.
>
[snip, again]
> =item 7
>
> Threads should be able to C<use> and C<no> their own
> modules, outside of
> the global ones. This allows each thread to only use the
> modules they need,
> saving on the global system bloat described above, and
> giving each thread the
> most control over its environment - such as letting two
> threads use two
> different versions of the same module.
>
> Discussion: Threads are mainly used in one of two ways:
> parallel processing
> of the same dataspace, such as loop processing with
> non-iteration-dependent
> data members; or "assembly line" parallel processing,
> with each thread
> doing a different function on a database, like thread
> signals conversion,
> with a buffer read, byte/nybble/bit swapping, data
> conversion, and buffer
> write split across multiple threads. I won't pretend to
> know which is truly
> more common, or more deserving of the threading model,
> but the second is
> certainly easier to use from an end-user perspective, and
> the first can
> be converted to the second with relative ease. This
> model allows different
> threads to do different things with little impact on the
> footprint of the
> program, by allowing each thread to C<use> its own
> modules.
>
> use English; # In main thread at compilation
> use Threads; # In main thread at compilation
>
> Threads->use("Foo"); # Loads Foo into main thread at
perl5-speak:
require Foo;
> runtime.
>
> my $thread2 = Threads->new(\&start_thread2);
> ...
>
> sub start_thread2
> {
> ...
> # Before this sub was called, the second thread was
> created, and it
> # reused English and Threads.
> Threads->use("Bar"); # Remember, this is this
> thread's Threads
> }
-- BKS
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/