Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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 code
            foreach ( @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.

And here is where my notes end. I wish I had a videotape of it. He's just great.

xoxo,
Andy
--
I was dreaming when I wrote this, so sue me if I go too fast.


In reply to My day with Damian Conway by petdance

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (11)
    As of 2014-09-17 11:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (72 votes), past polls