Live data from Hacker News

Perl code that is syntactically correct only on Fridays

github.com

1–10 of 233 posts

Re: Perl code that is syntactically correct only on Fridays

#5
post #4

This leverages Perl's BEGIN block which runs before the main part of the code. I suppose the same fun could be had in other languages: if day_of_week is "Friday" eval(piece_of_incorrect_code) else do_sane_operation

Moral quandary of the morning: Do I point out the sign error or do I just say please don't merge this?

Re: Perl code that is syntactically correct only on Fridays

#6

I have written code that only works in winter because of daylight saving times and some unfortunate date conversions, but having a temporary correct syntax is really a new high.

I have written code (at work) that crashes when the moon is in a specific phase.

I had a "switch(moon_phase)" and forgot one of the cases... And the Android app was in debug mode, so any uncaught exception brought the whole thing down.

Re: Perl code that is syntactically correct only on Fridays

#7
post #6

I have written code that only works in winter because of daylight saving times and some unfortunate date conversions, but having a temporary correct syntax is really a new high.

I have written code (at work) that crashes when the moon is in a specific phase. I had a "switch(moon_phase)" and forgot one of the cases... And the Android app was in debug mode, so any uncaught exception brought the whole thing down.

Having the code crash every full moon would be pretty cursed tbh.
Post reply on HN