
Beman Dawes wrote:
On Thu, Feb 18, 2010 at 10:35 AM, Stewart, Robert <Robert.Stewart@sig.com> wrote:
You state that extension() returns the period to allow distinguishing between an empty extension and no extension. That seems wrong. Typical use cases for working with the extension will require stripping the period before proceeding, so you push extra work onto the client. Furthermore, I can't think of a case in which extension processing code would work differently when there is no extension and when the extension is empty. The extension is an empty string in both cases. Since you already provide has_extension() for distinguishing that there is one, extension() should return an empty string when nothing follows the period.
IIRC, that was Volodya's original design and I can't recall anyone ever complaining about it. True, we didn't have the has_extension() function, but still, I hate to break existing code. Does anyone else have a strong opinion?
FWIW, the GNU Make function 'suffix' also sets a precedent of including the '.' http://uw714doc.sco.com/cgi-bin/info2html?%28make.info%29File%2520Name%2520Functions&lang=en On the rare occasions I've had cause to use it this has seemed natural. John Bytheway