News for hackers. Stuff that matters.
Re:Teaching Perl to Undergraduates by wyuenho on Sunday February 20, 2011 @12:13PM (#2242345)
I think what you have said is quite fair. However, I must clarify that I wasn't criticizing Perl's use of sigils, I was criticizing Perl's use of punctuations. There's big difference. Sigils does indeed make the types of variables clear, tho I find that context alone is enough. Objects in natural languages don't have to have types in their spellings to convey their categories after all. The use of genders in some languages is superfluous, Chinese doesn't require that.

All I'm saying is, Perl requires too much more mental power to process than Python because of it's large vocabulary and inconsistent grammar rules. It is really a natural language, but a natural language is not needed for programming.

Re:Teaching Perl to Undergraduates by bellaire on Sunday February 20, 2011 @01:58PM (#2242674)
Yeah, punctuation, wow. I mean, here's a sierpinski triangle generator:

32.times{|i|i.upto(31){|k|putc~k&i>0?32:35};puts}

Oh, wait. That's Ruby. I meant to say:

<?for($n=33;$k=--$n;print~\xf5)for(;$k;)echo-$n&--$k?~\xdf:~\xdc;

Oh, sorry! That's PHP. My bad... here we go:

print map($%&$_?$":'#',0..~($%=$_)),$/for-32..1

There we go... You're right, Perl is so much worse!

The point is, of course, you can write ugly code in any language, or you can write beautiful code in any language. Python actually is fairly legible nearly all the time...

n=32

while n:print''.join('# '[-n&k>0]for k in range(n));n-=1

but that comes at the cost of added verbosity and reduced flexibility . Whether that's better is a matter of taste, not of fact.

Re:Teaching Perl to Undergraduates by tene on Thursday February 24, 2011 @12:57AM (#2257083)
I'm sorry, but which grammar rules in Perl 5 are inconsistent? I've taught Perl 5 professionally, and while I certainly do acknowledge that Perl isn't optimal for learning, "inconsistent grammar" is not on my list. It does have a more-complex grammar than, say, lisp, but it's still an extremely consistent grammar, as far as I've been able to tell.

I also disagree with the claim that a large vocabulary in Perl is a notable issue. The size of the Perl grammar and language is sufficiently smaller, in my experience, than the size of all of the library APIs that I have to deal with when writing Perl programs.