On Fri, Apr 20, 2012 at 8:44 AM, Sherif Ramadan <theanomaly...@gmail.com>wrote:

> > But in order to be case insensitive, PHP needs to know that
> strtolower("A")
> > == 'a'. So if you use Cyrilic for userland functions/classes, php needs a
> > cyrillic aware strtolower function. Then the problem is that core
> > classes/functions need to use a plain ASCII strtolower for case
> > insensitivity. So you cannot both write code in cyrillic and interface
> with
> > plain ASCII internals. One possible, but less than optimal solution is to
> > first try a locale aware strtolower, then try a plain ascii strtolower
> when
> > looking up symbols.
> >
> > John
>
> I can see the confusion about PHP's case-sensitivity and how it mixes
> and matches between case-insensitive functions/classes/(arguably even
> constants), and case-sensitive variable names, for example.
>
> Its naming rules are a little bit inconsistent in that regard. I just
> don't see a point in making it completely locale aware. The fact that
> you can do soefunc() and SOMEFUNC() and still invoke the same function
> is a benefit.


Could you elaborate?  Aside from making PHP forgiving of typos and overall
laziness on the part of the coder, and of course BC notwithstanding, I'm
not sure I understand what benefit there is to preserving this inconsistent
behavior.


> And I suppose for those using UTF-8 encoded function
> names it might be convenient to make them case-sensitive as well. I'm
> not going to argue that it's not. I'm just going to say that it
> doesn't seem to be a significant problem.
>

When I was at Microsoft, I got into a little argument with some folks from
the Windows division about this very issue-- except, in this case, it was
about case-sensitivity in the filesystem.  They essentially made the same
argument; i.e. "Why would you want 'Find.exe' and 'find.exe' to be two
separate things?!"  I countered that I may want to add a library to the
PATH that contains a file with the same name, such as UnxUtils.  "Why would
you want to do that?!  Windows' find.exe is way better than the Unix one,
anyway!"....  And then my brain exploded.

Turkish localization notwithstanding (I confess that I know absolutely *
nothing* about that lol), one possible use-case could be if you're
including an external library/framework that contains a function with the
same name but different case.  I'm not sure how likely that is, mind you,
but I can see that as one potential benefit.  Either way, I guess my point
is that the arguments for/against this seem to parallel the arguments for
Windows-style fso case-insensitivity vs. Unix-style fso case-sensitivity.

--Kris


> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to