On Fri, Sep 19, 2025 at 02:55:02AM +0200, Bruno Haible wrote: > [CCing sc22wg14]
[I've removed WG14, as I think planning outside of their sight can be more productive.] > Hi Alejandro, Hi Bruno, > > There are other equality functions I've proposed for C2y: > > > > n3612, alx-0019r4 - add strpfx(), stppfx(), wcspfx(), and wcppfx() > > <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3612.txt> > > > > n3613, alx-0020r3 - add strsfx(), stpsfx(), wcssfx(), wcpsfx() > > <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3613.txt> > > The function names in these proposals are an abomination. My original proposal was strprefix(), stpprefix() strsuffix(), stpsuffix() The committee pushed me away from those names into the shorter ones, but I like these. If you prefer them, I'd welcome you to use them. Since gnulib would be the first implementor, and my proposal won't be voted until February or March, gnulib has the chance to influence on the name. If you implement them as XXXprefix() and XXXsuffix(), I'll change my proposal, due to prior art. The committee, a priory, would refuse such common names, due to fears of breaking much existing code. However, if major existing libc implementations use them, it might turn the votes. If you start with strprefix()/suffix(), and then glibc may follow, we have two of the major libc implementations. musl and Bionic would probably follow for compatibility. But this must come from implementations. The committee will not help. > Like Collin Funk (as a representative of the younger generation) said [1]: > He prefers longer names. > > When strcmp et al. were first created, assemblers and linkers limited > symbols to max. 6 characters. (This limitation was adopted in Fortran 77 > as well.) Also, typing on punched cards was a pain; therefore it was > useful to have short identifiers. > > But that was 50 years ago! Nowadays, identifiers have become longer > in all programming languages. > > It has become clear that maintainable code is being _read_ by developers > many more often than it is _written_. And for writing, IDEs nowadays > have identifier completion. So, everyone should be using readable > identifiers. > > And "readable" also implies "pronounceable" [2]. While "strcmp" is > typically pronounced "string-compare", 'stppfx' is simply not > pronounceable. Agree; strprefix() is more pronounceable, and thus mentally readable. Have a lovely night! Alex > (I say this despite being accustomed to German language, which has > words with up to 7 consonants in a row [3].) > > When words like "break" were shortened to 'brk', and "span" to 'spn', > by eliminating vowels, that was due to the limitation of 6 characters. > Nowadays such shortening is not only not needed, it is counter-productive > for maintainability. > > And when you shorten "prefix" to 'pfx' and "suffix" to 'sfx', you are > not only eliminating vowels, you also removed one of the consonants. > > ISO C already has standardized longer identifiers: > > fegetexceptflag > fe_dec_getround > fmaximum_mag_num > decodebind128 > atomic_compare_exchange > atomic_flag_test_and_set > atomic_flag_test_and_set_explicit > stdc_first_leading_zero_ull > memset_explicit > > the longest of these being 33 characters long. > > > I know you already have str_startswith() and str_endswith(). > > Yes, and these names in Gnulib have the descriptiveness and > pronounceability that I think *all* new identifiers in ISO C > should have. > > > the reason we chose those names in the > > committee --originally, the proposal was for stpprefix() and > > strsuffix()-- is that those compacted names are usually avoided by users > > as they know libc is more likely to take those. Thus, there's less > > existing code that would conflict with those names. > > I don't think this is a strong enough argument for forcing > unreadable and unpronounceable names down to all C programmers. > > Regards, > > Bruno > > [1] https://lists.gnu.org/archive/html/bug-gnulib/2025-09/msg00212.html > [2] because that happens in the developer's brain > [3] Auskunftspflicht > > > -- <https://www.alejandro-colomar.es> Use port 80 (that is, <...:80/>).
signature.asc
Description: PGP signature
