Hacker News new | ask | show | jobs
by vultour 2513 days ago
The most obnoxious parameter passing in existence? The magic variables everywhere? Perl code is an unreadable heap of spaghetti, I’d much rather be figuring out unallocated memory bugs in C then read Perl.
3 comments

Is its function parameter passing really more obnoxious than python, which lets you mutate the default parameter across calls:

def foo(bar=Bar(1)):

Unless bar is a primitive type, in which case each invocation gets the same value?

def foo(bar=1):

Perl wears its idiosyncrasies as badges of honor. Python keeps them hidden so they can sneak up on you when you least expect it.

"Vell, zis is perfectly normal behaviour for a python", to rephrase Gag Halfront.
But why obnoxious? Do you know how old Perl is? Have you written shell scripts before? My point is, some of choices Larry and others made wouldn't necessarily be made today, but there's a history, a lineage, a reason for all of this. I actually like the magic variables, but as I said in my other comment, you need to learn it first. X language is an unreadable heap of spaghetti if the programmer writes X language in an unreadable way.
Python only postdates Perl by 3 years.
Perl5 - which is what people refer to as "perl" - came out in 1994.

Python3, which is incompatable with python2, came out in 2008.

Way to move the goal posts into separate area codes.

If you're going to judge python by python3 you should at least hold perl to 5.020

> Do you know how old Perl is?

Same age as Haskell.

Don't forget sigils. Because the difference between @foo and $foo is obvious, right?
Not to someone who doesn't know Perl. But this is the same for every language. No one should be picking up a new language and working with it if they don't know it.

EDIT: To clarify, I mean there should never be the expectation that you can start working in a language in earnest without properly learning it.

That difference is indeed obvious. The issue is sigil variance.
Highlighting sigil variance was my point, poorly stated.
Perl5 does not have "sigils", BASH, BASIC and Perl 6 have sigils.

Perl 5 has dereference operators, which got called "sigils" by lazy documentation and book authors.

@ → A → array

$ → S → scalar

That's how I learned and remember them.

What makes that less obvious is when you work with references to arrays; the reference itself is a scalar, so it gets the scalar sigil. You can dereference it, though, by sticking an array sigil in front of it, thus telling the interpreter "hey, this is a scalar reference to an array".