On Fri, Apr 4, 2008 at 7:20 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Chas. Owens wrote: > > On Thu, Apr 3, 2008 at 8:37 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > snip > >> > * Note, this is not real Huffman encoding, just Larry Wall's version > of it. snip > > from http://www.perl.com/pub/a/2007/12/06/soto-11.html?page=2 by Larry Wall > > Each symbol has to justify its existence according to Huffman coding. > > Thanks for the link Chas; it's fascinating - Larry is a remarkable man. > > But he's pulling your leg. Most of what he writes (including the Camel) > is written tongue-in-cheek, and this is no exception. snip
No, it is a playful analogy used to illustrate his beliefs. It happens to be one he uses repeatedly (the I first sent was the first one google found): from http://dev.perl.org/perl6/doc/design/apo/A05.html Poor Huffman coding Huffman invented a method of data compaction in which common characters are represented by a small number of bits, and rarer characters are represented by more bits. The principle is more general, however, and language designers would do well to pay attention to the "other" Perl slogan: Easy things should be easy, and hard things should be possible. However, we haven't always taken our own advice. Consider those two regex constructs we just saw: (?<=...) (??{...}) Which one do you think is likely to be the most common in everyday use? Guess which one is longer... There are many examples of poor Huffman coding in current regexes. Consider these: (...) (?:...) Is it really the case that grouping is rarer than capturing? And by two gobbledygooky character's worth? Likewise there are many constructs that are the same length that shouldn't be: (?:...) (?#...) Grouping is much more important than the ability to embed a comment. Yet they're the same length currently. You might note that, in this case, Huffman encoding is being used as a reason for lengthening and shortening parts of the regex syntax. snip > I'm sure he didn't mean that typing the extra four characters in > 'foreach' was a waste: if you don't have time for that you don't have > time for sleepng or eating. snip I need the time back from typing each after every for in order to have the time to eat and sleep, but seriously, common things should be short and uncommon things should be longer. To drive the point home, I will note that there is no foreach loop in Perl 6. The for loop uses iterator style exclusively and if you want the c-style for loop you must use a new statement: loop. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/