<intro>
I know that Duff's device in perl has already been discussed here and most probably elsewhere. In particular a Super Search turned out the following threads:
Basically they all discuss the perl version/translation of the actual Duff's device logic. But I'm asking something different.
</intro>
Specifically I'm asking about highly bummed perl code, that one has felt the need to write instead of a less obscure version. Indeed there would be tons of obfu and golf code to exhibit - but I'm not talking about stuff done for fun. I'm rather focusing on so called "production code" in which one has felt for whatever reson the need to leave obscure code spotting an intricate and maybe surprising perl feature, probably along with a big comment indicating both what he/she is doing and why he is doing it that way.
So, do you have a favourite code portion of yours that you would regard as your own perlsonal equivalent of Duff's device?
Note: in case you wonder and before you point it out... since this has directly or indirectly to do with some sort of optimisation: yes, I know that "premature optimisation is the root of all evil", and I'm asking just out of curiosity!
Update: to partially answer to myself, I was thinking about something along the lines of this example of mine, and check in particular merlyn's comment, which IMHO makes it appropriate for this discussion. But I bet there must be something more akin to the abstract essence of "Duff's device"...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl's own Duff's device?
by Zaxo (Archbishop) on Dec 22, 2005 at 16:41 UTC | |
by blazar (Canon) on Dec 22, 2005 at 16:50 UTC | |
|
We call it "XS"
by Anonymous Monk on Dec 22, 2005 at 20:06 UTC | |
by blazar (Canon) on Dec 23, 2005 at 09:06 UTC | |
|
Re: Perl's own Duff's device?
by choedebeck (Beadle) on Dec 22, 2005 at 16:23 UTC | |
by blazar (Canon) on Dec 22, 2005 at 16:40 UTC |