4 ms·
It wasn't really all that exciting - I was writing an IRC bot for fun, a Roberts Rules of Order moderator. Well, Roberts Rules of Order imposes a structure on
by Vivtek 17y ago
It wasn't really all that exciting - I was writing an IRC bot for fun, a Roberts Rules of Order moderator. Well, Roberts Rules of Order imposes a structure on events that requires timing, so for instance, if somebody gets the floor, then one minute or two minutes later, we warn them their time is expiring.
The epiphany was twofold. First, I realized that passing an anonymous function pointer to a queue is a lot more general than defining, say, a bunch of event names. This makes the design of the event queue really lightweight.
The second part of the epiphany was that anonymous function pointers in Perl are closures, with lexical bindings to the environment at the time the pointer is created. So my event queue reduced to a simple list of times and closures - magic! Events are entirely general and you can spin off just the event queue logic as a separate module without restricting any later options about what types of event you'll be queuing. It was probably the most satisfying programming I'd done in a decade.
I should note that I stopped doing programming for my bread and butter in 2003 or 2004, and switched to technical translation instead (easy to quote, no debugging, no disputes about what was done or whether it met the user's expectations - it's like programming for hire without any of the downsides!) So I program for fun and to build my own tools, with the result that a month or two may go by without my writing much of anything. That's lots of time for the subconscious to reorganize between exposures, so essentially I'm relearning programming a couple of times a year. Lately I think I'm getting kind of good at it.