Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Let's assume that the debate was legitimate, doesn't that still put us one "replace all" away from fixing the problem?

I don't understand how these guys were "deadlocked" for weeks.



Because the spelling wasn't the root cause it was a symptom of a culture that had gone so badly wrong that people engaged in petty arguments just as a way to score points.


To be fair, a search and replace for "dialog" would also match patterns like, y'know, "dialogue" too, at least in all the naive replace-all algos I've seen in IDEs.

So, the traditional CTRL+F, or :%s/dialog/dialogue/g would have resulted in at least some instances of 'dialoguegue' as a result. Yeah, the obvious remedy there is :%s/guegue/gue/g, but that too could lead to unintended results, etc.

Not that I don't agree with the intent of your statement, search and replace across 20k lines of code, over however many files, is likely a more involved process than it sounds like.


To match dialog but not dialogue in vim:

    dialog\>
...in other regex systems:

    dialog\b
"dialog" as part of a variable name with underscores:

    :%s/dialog_/dialogue_/g
"dialog" as part of a variable name with CamelCase:

    :%s/\([dD]\)ialog\([A-Z][A-z]*\)/\1ialogue\2/g
You don't need to capture every case in a single regex substitution, you can use a handful to cover pretty much every case though. This sort of change should not take more than a few minutes max of developer time.

I don't have experience with them, but I imagine an IDE with refactoring support should make these sort of changes trivial.


Maybe some thing like s/dialog\([^u]|$\)/dialogue\1/g

Or use variable renaming in an IDE that actually parses the code.


You can always replace dialoguegue with dialogue again afterwards.


Or use an AST and do a structural replace, rather than use text.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: