Monday, May 21, 2007

What is Perl 6?

Since this is an introductory post to this, a blog dedicated to Perl 6, I figure I should establish a few things about what Perl 6 is, before just 'jumping in.' Perl 6 is more than a language, it's a community and a development effort by those willing to be involved.

To start, I'll go ahead and list of a few things from the 'Perl 6 jargon file', so you're not caught by suprise when these are referenced to later:

Apocalpyse: Larry wall, BDFL of the Perl project, designed Perl 6 to be 'the community's rewrite of perl,' where Perl 5 was his rewrite of Perl. To do this, people from all around the globe submit RFC's to the perl6-language mailing list (short form: p6l which is how I'll refer to the list from now on,) talking about what they believe what changes should take place in the language. Wall manually answers these RFCs and describes whether he accepted or rejected the change, and why. An apocalypse is a collection of these RFC's and their answers. Every apocalypse directly relates to a chapter of the Camel book.

Note, that Apocalypses, after their initial release, can be revised. It is not uncommon for an Apocalypse to soon change after it's publication; if you have code that isn't working, but only 'proved to be correct, yet not tried,' [sic] check the accompanying Apocalypse: the syntax and specifications may very well have changed.

Synopsis: After an Apocalypse, a Synopsis is written. The synopsis essentially sums up the changes taking place described in a single Apocalypse. The name is just what it sounds like. Synopsis are generally more approachable and less lengthy than their accompanying Apocalypse.

Exegesis: The Exegesis are practical explanations and code samples of the changes taking place as described by both the Synopsis and Apocalypse. These are your examples of the specifications the Apocalypses describe.

Pugs: Pugs is an implementation of Perl 6, written in Haskell. Pugs intends to bootstrap the perl 6 compiler by writing it in Haskell. The objective is that once all the pugs milestones are done, that if needed, Pugs will be rewritten in Perl 6, to develop a fully fledged Perl 6 compiler, in Perl 6. You can find more on the wiki entry. Commit access to pugs is handed out quite liberally, and anybody is free to work on whatever they feel needs to be worked on. Just the way Perl 6 is a community effort and a rapidly changing landscape, so is Pugs.

Note that Pugs is not the only implementation of Perl 6, it is merely the most complete and established. Via the use of the v6.pm module, it's possible to write limited amounts of Perl 6 in Perl 5 (you may think it as either 'perl-on-perl' action or 'perl-on-haskell' action.)In my future posts, I will generally stick to Pugs for the implementation, as it is more feature complete and more accurately reflects the current state of Perl 6.

Parrot: Parrot is a virtual machine, designed to run Perl 6. The virtual machine is designed for fast (one of it's primary goals) execution of dynamic languages such as, but not limited to, Perl 6. Multiple languages can run on Parrot (languages for parrot can be constructed via the use of a very interesting compiler-toolchain, designed for Parrot), and the architecture is modern and well done. Parrot is discussed primarily on the perl6-internals mailing list (p6i.)

Please keep in mind, development of Parrot in relation to the actual Perl 6 language is nigh orthogonal: Parrot's only obligation is to support Perl 6 and it's semantics, but the language designers have no say in how it's done or why. Parrot is, as well, the only virtual machine for Perl 6. Communication between these two branches is done, however, they are two seperate entities by all practical means.

So now that the lingo is out of the way, what's the real deal with Perl 6? How can you get involved?Getting involved is essentially as simple as joining the mailing lists (and I would recommend joining IRC as well: irc.freenode.org #perl6) and posting. That's it. Perl 6 is a community effort in its entirety: you, the people, say what stays and what goes. Submit your RFCs, comment on others, the power to change the language is yours.

Aside from the community, Perl 6 has changed a lot technically. Niklaus Wirth said that if we add things to a language, we must throw things away. You are still writing perl, and you will still be backwards compatible, but a lot of things are changing from Perl 5 to Perl 6. Things are getting added, things are getting thrown away.

Quick examples are:

Sigil invariance. When referencing an array itself (or any other type, for that matter), or an element of the array, you always give it the original sigil you declared it with, i.e. you are going from $arr[1]; to @arr[1];. Note, context in Perl 6 still exists, but sigils do not vary.Example:

Object orientation is full blown now. Classes and object-orientation is greatly improved, as you now have classes, [multiple] inheritence, private/public pieces of data, constructors and destructors; object orientation is much more complete.

Regex's no longer exist. You're using Rules, now (this change in lexicon is due to the fact that perl's "regular expressions" are so far off the mark of a traditional, formal regular expression, that they were renamed.) One of the greater things about Rules and Grammar's in the new Perl 6 engine is that Grammars are essentially 'classes for rules,' a grammar just inherits from the Rule class itself.

Static types. Perl 5 was a dynamic language, Perl 6 adds static typing capabilities. These are simply strictly optional annotations to your already existing variables to explicitly define your type. Either style of programming can be used.It's interesting to note that as you can specify types to a variable, you can specify two kinds: a type refering to what the variable holds (strings, int's, etc.) and a type referring to what the variable actually is; a hash, an array, ex:

pugs> my Int $i is scalar;pugs> $i = 1;pugs> say $i1Bool::Truepugs>

This is not limited to the built in types, any may do, including classes.

Laziness. Lists and the like are now implicitly lazy, meaning you can do things such as my @a = 1...;

Various syntax changes. Parenthesis in a large majority of constructs are strictly optional. Array's may be constructed in a 'stream of words' fashion using the < > operators, rather than qw(). I.e., from my @a = qw(a b c d); you go to my @a = <a b c d>;. Hash values can be referenced the same way, i.e. %hash<some_key>; Prototypes for subs can simply be done via sub name { ... };. There are more various little changes around, but none of these are hugely significant ones.

Those are just a few of the changes. For more, I suggest you read these.

Perl 6 is a big change to an already very popular programming language. One isn't going out the door for another to come in the same day: the adoption will be slow, but it is a needed change and a good one for both the Perl community, and Perl itself. If you would like to contribute, I can only suggest you sign onto IRC/mailing lists, and you speak your voice and do what you think you need, or are able, to do.

36 comments:

Nice introduction, I enjoyed the Camel Book seven years ago and now I'm interested in exploring new languages with reflection andmetaprogramming orientation (Ruby for example). I was wondering if Perl 6 is a good one to do things like that (create DSL, etc ...)

Good work, I'll keep a bookmark to your blog to stay in tune with the progress of the thing.

When ever I surf on web I never forget to visit this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]You have really contiributed very good info here diveintoperl6.blogspot.com. Do you pay attention towards your health?. In plain english I must warn you that, you are not serious about your health. Recent Scientific Research presents that closely 80% of all USA grownups are either chubby or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Therefore if you're one of these people, you're not alone. Infact many among us need to lose 10 to 20 lbs once in a while to get sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? You can easily lose with with little effort. Some improvement in of daily activity can help us in losing weight quickly.

About me: I am writer of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health expert who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for fast weight loss.

Generic Viagra (sildenafil citrate; brand names include: Aphrodil / Edegra / Erasmo / Penegra / Revatio / Supra / Zwagra) is an effective treatment for erectile dysfunction regardless of the cause or duration of the problem or the age of the patient.Sildenafil Citrate is the active ingredient used to treat erectile dysfunction (impotence) in men. It can help men who have erectile dysfunction get and sustain an erection when they are sexually excited.Generic Viagra is manufactured in accordance with World Health Organization standards and guidelines (WHO-GMP). Also you can find on our sites.Generic Viagra is made with thorough reverse engineering for the sildenafil citrate molecule - a totally different process of making sildenafil and its reaction. That is why it takes effect in 15 minutes compared to other drugs which take 30-40 minutes to take effect.[b][/b]Even in the most sexually liberated and self-satisfied of nations, many people still yearn to burn more, to feel ready for bedding no matter what the clock says and to desire their partner of 23 years as much as they did when their love was brand new. The market is saturated with books on how to revive a flagging libido or spice up monotonous sex, and sex therapists say “lack of desire” is one of the most common complaints they hear from patients, particularly women.

Do you guys watch movies in theater or on internet? I use to rent DVD movies from [b]Netflix.com[/b]. Recently I discovered that we can watch all new movies on internet on day, they are released. So why should I spend money on renting movies??? So, can you guys please tell me where I can [url=http://www.watchhotmoviesfree.com]watch latest movie Cheaters 2010[/url] for free?? I have searched [url=http://www.watchhotmoviesfree.com]Youtube.com[/url], [url=http://www.watchhotmoviesfree.com]Dailymotion.com[/url], [url=http://www.watchhotmoviesfree.com]Megavideo.com[/url] but, Could not find a good working link. If you know any working link please share it with me.

get kanye west music for free [url=http://mp3-s.co.uk/all_music-hubert-dupont-149759-1/]Hubert Dupont[/url] adams family music and amazon http://mp3-s.co.uk/all_music-peter-gabriel-9-1/ decrypt protected music free piano sheet music for kissing you [url=http://mp3-s.co.uk/all_music-madhouse-17466-1/]Madhouse[/url] pendulum music http://mp3-s.co.uk/all_music-riddim-track-15-1/ moulin rouge soundtrack sheet music listen to free music online phsody [url=http://mp3-s.co.uk/all_music-lite-frequency-37461-1/]Lite Frequency[/url] schott music music lessons atlanta [url=http://mp3-s.co.uk/all_music-the-cat-box-quartet-74124-1/]The Cat Box Quartet[/url] vietnamese sheet music http://mp3-s.co.uk/all_music-anathema-31-1/ music videos vhs tape teddy bear music [url=http://mp3-s.co.uk/all_music-general-malice-43827-1/]General-Malice[/url] music parodies http://mp3-s.co.uk/all_music-sx01-16-1/ math facts about music

The text in your post seem to be running offthe screen in Firefox.I'm not sure if this is a formatting issue or something to do with browser compatibility but I figured I'dpost to let you know. The layout look great though! Hope you get the problem solved soon.