Hacker News new | ask | show | jobs
by handoflixue 1840 days ago
Depends on whether your relevant criteria is "those 3 words at random" or you have some reason to draw attention to the fact that they all end in "ex".

If I saw that list, I'd certainly assume there was something special about the "ex" ending since they don't otherwise have much in common and it's extremely unlikely for random chance to produce three "-ex" words just by chance. The shorter regex does a good job of highlighting that yes, "-ex" is the relevant criteria we care about.

1 comments

It is easy to produce very brittle code by assuming a premise that allows one to rationalize being clever. Or as the British sometimes say “too clever by half.”

I just picked three words I fancied at the time I was illustrating my point. Not random, but not because -ex was important. The language game I was playing was writing an HN comment for amusement.

The finite state machine of my regular expression has one fewer nodes than yours. If that ain’t simpler it will do until simpler shows up.

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? — Brian Kernighan

The language game we're playing is defining the rules for the language game we're playing. In your extension of the rules, adding a requirement of extensibility (to add 'indices') is a valid move; in your opponent's version it isn't. It could just as well be argued that it is adding the extensibility requirement that is “too clever by half.”