On 2008-Apr-30, at 1:29 pm, Brandon S. Allbery KF8NH wrote:
On Apr 30, 2008, at 15:14 , Jon Lang wrote:
On a side note, I'd like to make a request of the Perl 6 community
with regard to coding style: could we please have adverbal names that
are, well, adverbs? "is :strict Dog" brings to my mind the English
-ly suffixes everywhere conflicts with Huffman coding, which per
@Larry is a primary design concern. Consider the leading colon to
be the Perl6 equivalent.
Logically, yes, a ":" on the front of a word is as good an indicator
of an adverb as an "ly" on the end. Psychologically, however, it
isn't; for one thing, my mind doesn't pronounce punctuation the same
way as letters. Whatever the reason, I've been reading English for
decades longer than I have P6 (and by the time I've spent that many
decades getting familiar with P6, I'll be even more familiar with
English... which is of course one of the reasons why Perl tries to
look kinda sorta like English in the first place; it may as well try
to look like half-decent English!).
But the more general point I wish to make is that extra characters
don't necessarily conflict with the goal of Huffman encoding. I
assume the idea was that extra 'ly's everywhere take up space that
isn't needed -- of course Huffman himself was concerned with
minimising bits, but in terms of Perl what we're interested in is
efficient understanding, not efficient storage.
Now "short code" is not a bad first approximation to "understandable
code", since longer reading-time will contribute to longer
understanding-time. But that's only a very rough rule of thumb: if
something is too short, it will take even more work to figure out what
it's saying, and thus any time saved by shortness will be swamped by
the much greater effort to figure out what the heck it means.
(In this particular example, it seems quite reasonable that the
cognitive dissonance from seeing an adjective where one's English-
trained brain is expecting an adverb will outweigh the negligible time
it takes to scan a couple of extra letters.)
That's why Perl6 has abandoned all the punctuation-variables from P5
in favour of their "use English" equivalents. Real words are longer
to read (and write) but easier to understand overall.
(Of course, more characters are less efficient to type, but except for
throw-away one-liners, code gets written once and read multiple times,
so Huffman meta-encoding dictates that we should optimise for
reading. And anyway, making code more efficient to write is the job
of one's text-editor, not the language. Maybe we should work on auto-
completion files for popular editors that will expand things like
":str" into ":strictly", etc.)
-David