Tech

Perl history: A look at the plans for Perl 6 evolving from Perl 5

Perl is somewhat unique among programming languages, largely because its inventor, Larry Wall, wanted his creation to resemble a natural language. For the most part, he has succeeded; Perl has evolved quite like a natural language since its inception in 1987, adapting to changing circumstances and a growing developer community. However, unlike with a natural language, Wall has always been the primary force behind Perl’s design and revisions.

Now, Wall is taking another step closer to his ideal. Instead of trying to generate all the ideas for Perl 6 on his own, Wall asked the Perl community to submit Requests for Comment (RFCs) on suggestions for the language. As he said during one of his so-called “State of the Onion” speeches, “Perl 5 was my rewrite of Perl. I want Perl 6 to be the community’s rewrite of Perl….”

The community brainstorming session that followed Wall’s announcement generated more than 300 RFCs. Of course, not all of those ideas were accepted, but Wall now has quite a bit of brainpower to work with in addition to his own.

Apocalypse Now

Since receiving the RFCs, Wall has been writing design documents for Perl 6, curiously titled “Apocalypses.” Generally, we think of an apocalypse as something that destroys — but the word also has another meaning, “something that reveals.” This is exactly what Wall is doing via his missives — revealing the design of Perl 6.

Wall has finished five of these Apocalypses so far, and he plans to release a few more. In the documents, he explains why some RFCs have been accepted and why others have been rejected. He also has taken the initiative to make changes where he feels they are needed, even if none of the RFCs addresses a particular issue.

Perl Major Renovation

It is an accepted fact that all projects evolve to some extent as they mature — if they do not, they stagnate and die. But the scope of the shift from Perl 5 to Perl 6 seems far greater than that seen in any other programming language from one version to the next.

“There is nothing comparable that I know of in programming language evolution,” Gurusamy Sarathy, who was the release manager for Perl 5.6, told NewsFactor.

Perl 6 project manager Nat Torkington confirmed the scope of the planned revision, telling NewsFactor, “There will be substantial changes in the move from Perl 5 to Perl 6. We’ve been hamstrung for a while by the need to maintain backward compatibility all the way back to Perl 1. There are some things we want to remove, because they seemed like good ideas when they were introduced but they’re more trouble than [they’re worth] now.”

Sweet Expressions

Although the design of Perl 6 has not been finalized yet, anticipation among developers and Perl hackers is beginning to build. Damian Conway, one of the Perl 6 design team members, told NewsFactor that he is excited about several features of the new version, including simplifications to the basic syntax of Perl, better interoperability with other programming languages, a more sophisticated type system, and a new regular expression and grammar mechanism.

Torkington agreed that the new regular expression syntax is one of Perl 6’s best features. “We’ve been living with the old regular expression syntax for 30 years, bolting on new features in increasingly awkward and ugly ways,” he said. “This represents the first rethinking of regular expressions in a long time, and [it] promises to take a lot of the pain out of writing and reading patterns to parse data.” In regular expressions, symbols are used to match patterns of text.

According to Torkington, the new rules greatly increase the capabilities of regular expressions, eclipsing the Perl 5 implementation of this technology. “The super-sweet part is that Perl 6’s rules aren’t just regular expressions,” he noted. “They’ve grown to encompass full recursive descent parsing, so you can use the same syntax to parse source code or complex file formats as you would use to pull apart fields from a string.” Whew! It may be technical, but in short, it is a Good Thing.

Interpret This

In addition to changes within the language itself, Torkington said he is looking forward to moving to a new Perl interpreter. “The Perl 5 internals are somewhere around a decade old, and they’ve been stretched and warped in sometimes painful ways to accommodate new features like threading and Unicode.” As a result of the switch to the new interpreter, called Parrot, it will be possible to implement all the features Perl now needs from the ground up.

If that sounds like a lot to take in, it is. The Perl 6 team is not holding back when it comes to changing the language — but neither are they planning to push people to adopt Perl 6 at a rapid pace.

Planning the Migration

In fact, the Perl developers know migration will not happen overnight, even when the language and interpreter are finished.

“I expect it’ll take two or three years,” Torkington noted. “That’s how long it took for a majority of Perl developers to move from version 4 to version 5. It does take a while for critical mass to build.

“In particular, I don’t expect that a lot of businesses will move their mission-critical applications when Perl 6.0.0 is released,” he added.

Conway agreed that businesses will not be in a rush to start using Perl 6. “Many organizations already have a huge investment in Perl 5 source code and in Perl 5 programmers, and they will only be able to migrate to Perl 6 incrementally. So it will probably take a few years before Perl 6 really begins to dominate the Perl world.”

Believe it or not, Conway said, “I regularly meet people whose business relies on Perl 4. And most folks I teach are still using Perl 5.005.”

Perl 5 Not Going Away

Indeed, businesses that still depend on Perl 5 have no cause to worry. Longtime Perl hacker Randal Schwartz, the co-author of Learning Perl, told NewsFactor that development is continuing on Perl 5. “5.8 [the most recent stable version] will be followed by 5.10, which is being worked on right now. And maybe even 5.12. 6.0 won’t be even in alpha stage for probably another year or two, and suitable for post-early-adopters for a year or two after that.”

Even after Perl 6 is released, Schwartz said, Perl 5 users will not have the rug pulled out from under them. “Perl 5 will continue to be supported for a long overlap period, because the designers are clear that Perl is frequently used in mission-critical applications, and that transitioning to a new code base should be made carefully.”

Conway confirmed that there will be no pressure to move away from Perl 5. “In fact, it’s precisely what open source Latest News about open source is all about,” he said. “You get to decide when and what you adopt, rather than being forced to upgrade whenever the monopoly decides you ought to.”

It is this culture and attitude, according to Sarathy, that made Perl so successful in the first place. “Perl has an enviable following of dedicated developers and users, and an open culture of innovation and sharing that is unmatched by any other modern language. The future looks very bright indeed.” (See part 2 here.)

(Originally written for and published on NewsFactor.com, which is now defunct, under the headline “Perl Features of the Future – Part 1.” Rescued via the Wayback Machine. Decided to put this back up since it’s an interesting look at a point in time for the Perl community.)

Categories: Tech

Tagged as: , , , , ,

Leave a Reply