A Peek into the Future

In this section, I’ll describe a few of the exciting things that we can look forward to, possibly in the next few major releases of Perl.

Multithreaded interpreter

Malcolm Beattie has released an early version of a thread-safe Perl interpreter based on POSIX threads. (Search for the “thrperl” in the Perl 5 Porters archive [Section 20.8].) This modified interpreter is not thread-hot; that is, it does not use threads itself (unlike the Java environment, for example, which uses separate threads for updating the user interface and for garbage collection). It allows the user to create as many threads as required and provides support for standard thread primitives such as monitors and condition variables. As currently implemented, all global data structures introduced in this chapter have simply become per-thread entities. That is, each thread gets its own set of stacks, its own stashes, and thread-local variables such as errgv ($@). Lexical variables are allocated out of subroutine and thread-specific scratchpads.

Static typing hints

Give hints to the interpreter for better optimization and type-checking. Larry’s example, which has acquired near “hello world” status on the p5p list, is as follows:

my Dog $spot = new Dog;

Now $spot is tagged at compile time as belonging to a class called Dog, so a call such as $spot->meow() will be a compile-time error, unless you have a mutant dog.

Faster objects

Expect better support for objects and a possible standard replacement ...

Get Advanced Perl Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.