3 ms·
> case sensitive function names Are you saying that function names should be case-insensitive?
by nawitus 10y ago
> case sensitive function names
Are you saying that function names should be case-insensitive?
- jacquesm 10y agoNo, I'm saying that if function names are case-sensitive that you're an idiot if you use that feature to distinguish between two functions otherwise named identically with different (important) side effects. The fact that the parameter set is different implies auto completion by an IDE was probably partially to blame here (if you did it by memory you'd have gotten a wrong parameter count warning). Some language features you best not exploit if you want to write reliable and bug-free (to whatever extent possible) code. This is not a typo so much as it is a very poor choice of naming convention.
- kartickv 10y agoI'm not the OP, but I think they should be case-insensitive, if only to prevent errors like this. If you think otherwise, in what situation would it make sense to have two functions with names differing only in case? No upside, only a downside.
- jacquesm 10y agoCase sensitive is fine if you throw an error when someone tries to define the same name with different case.
- kartickv 10y agoThat gets us to 99% of what I had in mind, by preventing bugs like this one, but the remaining 1% is: why, then, generate an error when someone invokes a function while specifying a different case? If there's only one function, does the case matter?