Getting Perl's New Number: 5.6
The next version of Perl will be known as 5.6 instead of 5.006 (or 5.1). In
this interview, Gurusamy Sarathy explains what new features you might expect
in Perl 5.6. Sarathy holds the patch
pumpkin for this release. Sarathy is joined by Dick Hardt who elaborates
on how some of the new developments improve Perl on the Windows platform. Sarathy
and Hardt are from ActiveState Tools Corp.The
Perl Porters group is putting together all the alpha-stage components for Perl
5.6, which should be available as a beta in mid-August.
This inteview also includes two RealAudio clips, one in which Sarathy discusses
threading in Perl and the other in which he explains the compiler models used
in Perl.
|
Gurusamy Sarathy
|
 |
Perl.com: Explain the new version-numbering
system.
GS: By tradition, we increment the third digit in the version number.
(5.005, for example.) It carried forward from the days of Perl 4 when we had
patch levels and sub-versions that would be conveniently represented as floating
point numbers. We had carried forward the convention for ease of comparing version
numbers.
It has been increasingly obvious that people are not recognizing the significance
of a new release. So it makes sense to increment the version numbers to the
most significant digit. We had to decide between calling it 5.1 and 5.6. We
thought that 5.1 might get confused with 5.001. So that's why we ended up with
5.6.
Perl.com: Are the Perl Porters behind this change?
GS: Yes. Actually, this change was suggested by Larry.
The change will allow us to represent version numbers as a sequence of three
numbers instead of as a single floating point number. This is similar to numbering
used for the Linux kernel where you have triples such as 2.2.3. We think this
will help Perl conform to some conventions that are emerging in the Open Source
community.
Perl.com:Just to be sure, what would the first
revision to 5.6 be called?
GS: The first revision to 5.6 would be 5.6.1. We might stick to using
even numbers for development releases and odd numbers for maintenance releases.
Update
Jeffrey Friedl asks: "What will be the major revision after 5.9? I've
heard Larry say that there will probably never be a Perl 6, but 5.10 would break
the ability to compare version numbers easily."
GS: The idea is to overload version number comparisons in a transparent
way so things like $] > v5.9.3 would be possible. Larry's idea was to use a
packed unicode string and make version numbers dual-valued (like $!), but we
might pick a different scheme based on what works out. The bottom line is that
there will be an easy (possibly transparent) way to compare such version numbers.
Perl.com: How will Perl extend its support for
Unicode in 5.6?
DH: The code that's in Perl now allows Perl to manipulate its
own data that may be in UTF 8 format, which is one of the representations for
Unicode. The work that we're adding allows Perl to interact when passing data
back and forth between Perl and the system. In this case, we're talking about
Windows NT and adding support for Perl exchanging data with the system.
Initial support for Unicode in Perl was driven by XML but it was
something that a lot of us have wanted in Perl anyway. That was the straw that
got the camel going, so to speak.
Better Lexical Warnings
Perl.com: How is Perl providing
greater control over its warning messages?
GS: You want to be able to control at a fine-grained level the kind
of warnings that Perl will emit and the kind of warnings that it will suppress,
if need be. Right now, warning control in 5.005 is a global switch. You either
have it on or you don't. You can control warnings locally using a special variable
but you cannot decide between having some warnings and not having others.
With lexical warnings, you can actually exclude classes of warnings. So
it provides much greater control of warnings. It also provides a way to promote
warnings into fatal errors.
New Regular Expression Syntax
Perl.com: In 5.6, there are
interesting changes that make regular expressions more powerful.
GS:You will be able to match balanced tokens, such as beginning and
ending tags in XML tags or balanced parentheses. There is a new control construct
that can be used in regular expressions. You can embed Perl code in regular
expressions. You can capture the state of a regular expression at any given
time and store it in Perl code, and then have that Perl code executed based
on whether something is matched by the expression. So you can use that mechanism
to maintain the state of regular expression engine. Rudimentary support for
that was available in 5.005 but it's been greatly improved since then.
It can be hard to use but it has great power. It can be used for a large category
of things that were previously unexplored. The end result is to make more classes
of operations easy to achieve using Perl regular expressions. It is something
of an exploratory feature at this point, but it is also something that is not
there in any other language I'm aware of.
Here's an example from perlre.pod that shows how balanced parenthesized groups
can be matched.
$re = qr{
\(
(?:
(?> [^()]+ ) # Non-parens without backtracking
|
(?p{ $re }) # Group with matching parens
)*
\)
}x;
print $& if "abc(def(),ghi());" =~ $re;
__END__
(def(),ghi())
The (?p{ EXPR }) syntax can interpolate arbitrary expressions at run time into
a regular expression. The above snippet sets up a recursive definition of the
regular expression which adapts the number of actual levels of parenthesis in
the string that is being matched.
Improved Threading
Perl.com: How will the
threading model change in 5.6?
GS: The experimental threading support that's been there since 5.005
has been something of a problem. We've realized that the model we've used has
some shortcomings. It has had a performance penalty that's quite serious. We've
been discussing alternate ways to achieve threading and do most of what the current model does and have explicit controls for sharing data, which eliminate
much of the performance bottleneck that Perl is suffering today.
There will probably be some user visible changes to how the threading
is currently used but we are willing to look at both the original threading
model and the current one as they evolve and understand the tradeoffs to make
it work for everyone.
How does it compare to Java's threading model?
Listen to Sarathy's answer:Real
link
Improved Compiling
Perl.com: What about the Perl
compiler?
GS:The compiler has seen a number of improvements since 5.005. They
have been incremental improvements mostly. In terms of usability, the compiler
was almost unusable for real work in 5.005 and we said as much in the release
notes. In 5.6, it will be much more usable. We have been running the test suites
and have had much more success. People have been pounding on it. The byteloader,
for example, will work much better because there are dedicated people devoted
to that particular activity.
Compiler work struggled there for a bit because Malcom Beattie had left
active development of the compiler. Other people are beginning to take over the
work and seriously develop it. We are hoping for a serious improvement in
compiler support.
Can you briefly describe Perl's compiler model?
Listen to Sarathy's answer:link
to Real (2:05)
Event Loop
Perl.com: There is work being
done on supporting an event loop for GUI processing.
GS: There is an increasing need for an event loop model that is supported
at the language level, and one that will be portable across platforms. Tk needs
an event loop for dispatching user interface events, and Perl needs to having
something parallel to Tcl, which has an event loop within the language.
The event loop has been discussed separately as an extension to Perl. It has
its own mailing list. I'm not sure it will make it into Perl 5.6 as a core feature.
Progress is being made on this work but I don't know when it will be done.
Zip Packaging
Perl.com: Will there be support
for Zip packaging of code?
GS: There is a patch that exists right now but it is not very
portable.
DH: You want to have the capability, like you have in Java, of
distributing code as one big Zip file. For a standard install, you can move a
small number of files as opposed to a huge structure. Also, it lowers the disk
space and makes maintenance a lot easier.
Perl.com: Does this enable
automatic download of Perl modules?
DH: No. That's something different. The Perl Package manager is
a way to distribute packages dynamically. We wrote that for the Windows
platform and provided the code as Open Source and now it's starting to be used
on Unix platforms. I think there will be advancements in that area as people
step up to solve some of the problems they have.
Conclusion
Perl.com: Are the features we've discussed in
the development release now?
GS: Some of them are in various stages of implementation and are in
the development release. This includes the compiler support and some of the
thread support. But others exist outside of Perl as patches that are passed
around for the Perl Porters.
Perl.com: What's the timeframe for the beta?
GS: There will definitely be a beta release by the time of the O'Reilly
Perl and Open Source Conference. Soon after the Conference, we should finish
up the work.
Perl.com: Is the beta release the same as a
development release?
DH: No, a developer release is still where there's missing parts.
The developer release is really for people who are working on the release so
that they can work with it. Once we've gone beta, there will be a feature
freeze. It will be called 5.6 beta and announced to the general public, not
just the development community.