On Sat, Dec 20, 2014 at 11:01:23PM +0100, F & N Laupretre wrote:
> Hi,
> 
>  
> 
> I don't know if this was discussed before. So, tell me what you think before
> I write an RFC.
> 
>  
> 
> I would like to propose that namespaces, functions, and classes become
> case-sensitive (constants are already case-sensitive). Actually, I never
> understood why they are case-insensitive. Even if the performance gain is
> negligible, I think it could be the right time to question this.

Variables are also case sensitive.

Identifiers can contain a-zA-Z0-9_ + where top bit is set.

Where an identifier is a function name or class name comparison is in a case
insensitive manner ... but only for ASCII ... using tolower_map in 
zend_operators.c

This means that those who write function (etc) names in some encoding that is
more than US ASCII find that case comparison is done in a case sensitive manner
- at least for those parts of identifiers that are written in characters that
have the top bit set.

Fixing this would require a lot of work as well as some way of determining what
character encoding the source file was written in ... different includes might
have different encodings.

We recently talked about a way of specifying source file encoding and decided
that it was not something to look at now (IIRC).

Making namespaces, function & classes case sensitive makes PHP consistent to
everyone - not just us 'US ASCII chauvinists' -- it is also the simplest 
approach.

It is a BC break; one which, unfortunately, cannot be found at compile time.
However: code, when fixed (ie consistent case spelling), will continue to work
with current PHP implementations.

Although many do try to write these identifiers in a case consistent manner it
will cause problems, however I would suggest that it would be worth doing.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

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

Reply via email to