Rabu, 02 Desember 2009

Requiring 5.10

So I decided to add "perl = 5.010000" in some of my dist.ini's. This is just because of one particular habit I recently acquired: writing "$a //= 1" and "$b = $a // 2". (Well actually I've rejoiced since defined-or is announced for 5.10, but for some reason have only begun to really use it in the past weeks.)

So much nicer than writing "$a = 1 unless defined($a)" and "$b = defined($a) ? $a : $2". It's the having to repeat myself aspect which I find disgusting, especially if $a is an expression. Which is one of the reason I always hate coding in PHP because in PHP you can't even say "$b = $a || 2".

I'm not switching, state-ing, say-ing, doing recursive patterns, or any of the other cool stuffs in 5.10. So am I so selfish for forcing 5.10 down the throats of other people just for such a minor convenience? The word externality comes to mind (having completed reading Superfreakonomics 2 days ago).

But it's a positive externality, really. ;-)

1 komentar:

  1. It's fine as long as your code will only run on Windows, or nobody else is going to use it.

    Perl 5.10 on Windows is pretty easy to get.

    Trouble is that Perl 5.10 on other platforms is still just a little flakey and not quite as common.

    But it's not unreasonable for you do rely on 5.10 now for certain types of application.

    BalasHapus

Catatan: Hanya anggota dari blog ini yang dapat mengirim komentar.