On Saturday, June 23rd, Damian Conway had a little free for all free-for-all workshop that he gave at College of DuPage in Wheaton, IL. He talked about a ton of different Perl topics, all of them enlightening. He's a great speaker, and I wish I could have gone to the 3-day class that he gave earlier in the week. Here are some random notes of interestingness that I scribbled down. Perhaps frag will want to add some of his own comments.
- ``$/ tells when to stop reading''
We all know about the $/ variable, but a new light dawned when Damian said ``$/ tells when to stop reading''. That's why $/ = undef makes Perl read an entire file: There's no definition of when to stop reading. How clear it is now. - Perl 6 may have the ... operator
Perl 6 may have the ..., which Damian pronounced as the ``yada yada yada operator.'' You'd use it as a placeholder for undefined code like so:sub mangle { ... return 1; }
Yes, that's a literal .... Executing mangle() would have Perl kick out a message like ``sub mangle is pending future code''.
- Typeglobs
``Typeglobs are like a box of chocolates'', he said, and then explained why in a way that let me finally understand the method behind the madness of typeglobs. Of course, typeglobs are going away in Perl 6. - Perl's phases
Big discussion of Perl's 5 phases: BEGIN, CHECK, INIT, execution and END, and when you'd want to use which one. - The benefits of golf
He didn't specifically explain that golf in the extreme way we golf here is good, but rather that ``The fewer characters you type, the fewer characters you can get wrong.'' He claims that there's a linear correlation between the number of characters in a system's source code and how many bugs it has. - Qualifiers, not control structures
In this codeforeach ( @foo ) { whack($_); }
the foreach is a control structure.
In this code:
whack($_) foreach @foo;
the foreach is a ``qualifier'', which is why you can't apply it to a block in that syntax.
- Perl optimizes a lot
The Perl pseudocode has no ifs in it. Anywhere. ``How can that be?'' I asked. He then showed the following reduction:if ( $x > 50 ) { do_something(); }
is the same as
($x > 50) && do_something();
It's all just a lot of booleans in there.
- The use of the v notation
Version strings are tracked with the v notation, like v5.6.0, which gives a string equivalent to chr(5).chr(6).chr(0). This is also handy for IP addresses, as in v127.0.0.1. - Attributes
Big discussion of attributes and the Attributes::* modules, most of which I didn't note because I don't see any direct application for them in my work. However, Perl 6 is going to make a LOT of use of attributes. - Object-oriented design
He presented his Spinal Tap-style list of Ten criteria for object-oriented design. This list will eventually be part of the standard Perl distro. - What's coming in Perl 6
Since Damian is sort of Larry's right hand man for language design issues, he's on top of all the changes that are going to be coming. Some of my favorites:- Here document improvements
Here documents won't have to be flush left.while ($foo) { for ( @list ) { print << "END"; Here's the text of the message I want to print. Note that I'm not flush left like I would have to be in Perl 5. The amount of whitespace before the terminating "END" is stripped from the front of each line. END } # for } # while
Many of us literally applauded and cheered. - Typeglobs go away
Everything will still be in symbol tables, but not as they are now. The fully qualified name of $foo will be the key in the symbol table, not like it is now, where $foo really means ``the scalar in the foo typeglob''. Also, lexical variables go into their own special symbol table MY. - Globals go away
All the global punctuation variables will go away or become properties of something else. For instance, instead of setting $/, you'll modify the insep() attribute of the file handle in question.
- Here document improvements
xoxo,
Andy
--
I was dreaming when I wrote this, so sue me if I go too fast.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: My day with Damian Conway
by frag (Hermit) on Jun 26, 2001 at 03:53 UTC | |
(tye)Re: My day with Damian Conway
by tye (Sage) on Jun 26, 2001 at 09:11 UTC | |
by Vynce (Friar) on Jul 02, 2001 at 16:43 UTC | |
by tye (Sage) on Jul 02, 2001 at 19:11 UTC | |
by stefp (Vicar) on Aug 28, 2001 at 15:29 UTC | |
by tilly (Archbishop) on Jul 02, 2001 at 18:10 UTC | |
Re: My day with Damian Conway
by tachyon (Chancellor) on Jun 30, 2001 at 16:08 UTC | |
by tye (Sage) on Jan 11, 2002 at 21:09 UTC | |
by tachyon (Chancellor) on Jan 31, 2002 at 12:43 UTC | |
by tye (Sage) on Jan 31, 2002 at 16:41 UTC | |
Re: My day with Damian Conway
by beretboy (Chaplain) on Jun 25, 2001 at 04:16 UTC | |
Re: My day with Damian Conway
by busunsl (Vicar) on Jun 25, 2001 at 11:00 UTC | |
by Abigail (Deacon) on Jun 26, 2001 at 03:50 UTC | |
by tye (Sage) on Jun 26, 2001 at 09:06 UTC | |
Re: My day with Damian Conway
by clemburg (Curate) on Jan 31, 2002 at 13:02 UTC | |
Re: My day with Damian Conway
by mikeB (Friar) on Jun 25, 2001 at 19:36 UTC | |
by petdance (Parson) on Jun 25, 2001 at 19:37 UTC | |
Re: My day with Damian Conway
by Maclir (Curate) on Jun 25, 2001 at 23:10 UTC |