in reply to "Perl is read-only!"
I think that one of the principal reasons behind Perl's "write-only" reputation is that it is so rich, i.e. TIMTOWTDI (which is arguably one of its strengths as well). I don't see any short-term solution to improving Perl's reputation in this regard. One may come up with a mini-Perl dialect (as I describe here) that, by virtue of being simpler (and more limited), would also be easier to read, but at best this would improve the mini-Perl's reputation; full Perl's reputation would remain unaffected.
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
TIMTOWTDI =/=> 0222
by kaif (Friar) on Jun 06, 2005 at 14:49 UTC | |
A lot of people say that "TIMTOWTDI is the main reason for Perl's write-only reputation", but I'm going to humbly disagree here. Instead, I argue that Perl's TIMTOWTDI- and 0222-ness instead both follow from something else: a huge language with lots of syntax that both mixes programming paradigms and manages to be unique at the same time. Here're a few examples of what I mean (please feel free to correct me or my examples if I'm or they're wrong!): This isn't a full analysis, but it's a start. What I'm saying is that TIMTOWTDI comes from some of the above (especially the function programming paradigms and regexes), but that the inherent nature of the above also causes write-only-ness. That is, they have a common cause, and not that TIMTOWTDI causes write-only-ness. Disclaimer: By the way, don't get me wrong ... I love all of these things about Perl, particularly one liners and the interaction with the Unix pipe philosophy. I, however, have talked with many people who don't like Perl since I usually mention that it's my favorite language. Update: Spelling, formatting, and such. | [reply] [d/l] [select] |
by Anonymous Monk on Jun 07, 2005 at 00:20 UTC | |
$_ and @_ are confusing largely because there's no single piece of documentation which lists all the functions that assume $_, which functions will implictly set it, and so forth. I'd add: perl is inconsistant. $_ acts like an alias inside a foreach, but doesn't have the same side effects outside the loop. @_ means @ARGV, or the parameter list, depending on whether you're in the main program body or not. Perl lets you do things in inconsistant ways: this is part of the TIMTOWTDI design. Once you let there be multiple ways to do it (inconsistant design, that accomodates multiple ways to do the same thing), you don't worry about a few more inconsistancies thrown in here and there, even if they're confusing to a novice. Try explaining the word, let alone the perl implementation of the term "autovivification", and watch the eyes glaze over really fast... | [reply] |
by blazar (Canon) on Jun 07, 2005 at 12:34 UTC | |
The lack of formal parameters (yes, I know they exist now, but most people don't use them) leads to things like sub mult{$_[0]*$_1}.Huh?!? Do they exist now? Aren't you talking Perl6 by any chance? If so, then I wouldn't say "they exist now"... Incidentally one of the things I like about Perl (but then I just love it to the bone in any case!) is how its simple parameter passing mechanism can be put to mimic so many different styles, e.g. by reference, by value, named. Update: Incidentally I recommend that when you change the subject of a node within a thread you include the previous one. I've been bit in the neck by this myself. See my own post at Q re nodes' subjects. | [reply] |
by kaif (Friar) on Jun 07, 2005 at 12:45 UTC | |
Yup, sorry, I think you're absolutely right. I really don't know why I was absolutely blanking, but I thought I remembered seeing formal parameter lists somewhere, and I guess that was Perl 6. Indeed, perlsub mentions "Perl does not have named formal parameters." I guess you could change my comment, if you want, to the fact that it's difficult to pass arrays and hashes into functions (with the canonical solution being references and the less typical one prototypes). Thanks for the heads-up. | [reply] |
by kaif (Friar) on Jun 07, 2005 at 12:53 UTC | |
Thanks for the title comment, too. Whenever I reply to an email and change the subject, I usually change the subject to "FOO (was Re: BAR)". I actually thought about doing it here, but I guess I misjudged when I thought that that would "clutter" the node. In the future, I'll do that; I think I'll let this stay for now. | [reply] |