On 6/20/15 5:27 AM, Vladimir Panteleev wrote:
Naming things

       There are only two hard things
       in Computer Science: cache
       invalidation and naming things.
       -- Phil Karlton


I think the issue we are struggling with here is that:

abbreviate -> abbreviated

This makes some sense. However, the past participle of "set" is "set".

So "set the extension" -> "a set extension" doesn't work, because "set" doesn't change. Our enemy here is the English language :)

If the original was named something like "modifyExt", then "modifiedExt" would be fine.

And my understanding of the pushback from Walter about renaming really has to do with avoiding breaking code for the sake of renaming. At this point (before setExtension has ever been released), it's "what is the best name". No code should be broken, the renaming objection shouldn't apply. I'm 100% in favor of not having both setExt and setExtension to mean different but similar things.

withExt seems better, and reasonably informative.

path.withExt("abc") -> "use this path, but with extension '.abc'"

And 'with' doesn't work with every possible updated version, we have to work around the quirks of English here.

But really, the egregious error is the slightly different yet identical names. It's like having setExt and set_ext mean different things. This also reminds me of std.regex vs. std.regexp. I never knew which one was the "new" version.

If there is some other idea besides setExtension (or some prefix of that), I think we should go with that. We could use some analog to 'set', like 'modifiedExt' or 'changedExt' if that sounds better. It just shouldn't be the same exact name, with differing levels of abbreviation.

-Steve

Reply via email to