Hacker News new | ask | show | jobs
by Raticide 5095 days ago
No other language has this problem. The locale is irrelevant. The class name is just a series of bytes; it shouldn't need to transform the case.
2 comments

True for languages which are case-sensitive.

Other languages like PHP (partially), BASIC or Pascal are case insensitive, so lookup has to be done case-insensitively which means that case has to be normalized, so transforming case of identifier becomes necessary. If it can't be done consistently, that's a problem.

So you use a culture-invariant locale for parsing. Still not a problem.
How do you lowercase in a culture-invariant locale? Or do you mean english?
No matter how you do it, a class name should always match when looked up with an identical string.
I believe it's because PHP supports case insensitive class names. It sounds like this will not change: https://bugs.php.net/bug.php?id=26575&edit=1
Class and function names are case insensitive. But variables are not. Go figure that one out.
I'd prefer them both to be one way or the other, but if they have to be different this is the right way to do it. For instance, functions can check to see what name the were called by (and process the call differently if we want to distinguish between cases). Variables can't do that so we must explicitly distinguish between them.