Skip to content

Comment on How to Write Unmaintainable Code – Naming

Comments

In the interest of fairness, and in regards to the "Underscore, a friend indeed", I'll point to the existence of eg, $_ and @_ as built-in Perl magic variables (you can get away with not using $_, but not @_). I have also been know to use _ for a variable I will not use later (eg, if a function returns two values but I'm only interested in one).

Additionally, in languages with pattern matching, '_' usually works like '*' and matches everything.

It's been a while since I did much perl, but FWIW I seem to recall doing (undef, my $foo) = do_stuff(). Perhaps modern perls have tightened up allowing undef as the target of an assignment.

Ah, I don't really use $_ for discarding variables, precisely because it is a magic variable.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.