Hello Andrei,

  we don't use '_' in class and method names. That said you must have
looked wrong:

[EMAIL PROTECTED] /usr/src/php-cvs $ php -r 'print_r(spl_classes());'|grep Spl
    [SplFileInfo] => SplFileInfo
    [SplFileObject] => SplFileObject
    [SplObjectStorage] => SplObjectStorage
    [SplObserver] => SplObserver
    [SplSubject] => SplSubject
    [SplTempFileObject] => SplTempFileObject

That is all new classes that are neither Iterator nor Exception follow
the mighty 'Spl' prefix scheme where 'Spl' is used as that is the name
of the extension.

But well it weren't PHP if there wasn't something not following the
decision not to use '_':

[EMAIL PROTECTED] /usr/src/php-cvs $ php -r 
'print_r(get_declared_classes());'|grep '_'
    [44] => __PHP_Incomplete_Class
    [45] => php_user_filter
    [115] => mysqli_sql_exception
    [116] => mysqli_driver
    [118] => mysqli_warning
    [119] => mysqli_result
    [120] => mysqli_stmt

Ok a little bit more of statistics:
[EMAIL PROTECTED] /usr/src/php-cvs $ php ~/tmp/ClassNameStatistics.php
make: `sapi/cli/php' is up to date.
Declared:   123   // Number of classes, all core + a few pecl
Adhering:   109   // Adhering to README.CODING_STYLE
Underscore: 7     // Using underscores
Violating:  7:    // Othere naming violations or stuff like 'stdClass'
Array
(
    [0] => stdClass,             // (1)
    [39] => dirs, util           // (2)
    [42] => Collator, unicode
    [43] => U, unicode
    [46] => Directory, standard
    [62] => ArrayObject, SPL     // (3)
    [122] => timezone, date
)

(1) Zend engine
(2) a private extension
(3) at least in line with ArrayAccess and ArrayIterator

best regards
marcus

Wednesday, July 19, 2006, 3:24:22 AM, you wrote:

> On Jul 18, 2006, at 5:08 PM, Greg Beaver wrote:

>> Andi Gutmans wrote:
>> [snip]
>>> an early point and we should make the right decision now. I'd  
>>> prefer that
>>> from now on going forward we prefix all new classes with Php. In  
>>> PHP 6, once
>>
>> This is a good solution.  3 extra characters for each class have not
>> hurt spl users (no reports of SPL-related carpal tunnel syndrome yet,
>> right? :).  It will make it simple to figure out whether a class is
>> internal (does it start with "Php?") and will eliminate all future
>> debate.  I have no qualms renaming the PEAR packages that I maintain
>> that start with PHP_ if this decision is made.

> I am not sure I like this idea of prefixing all the classes with  
> PHP_. Having PHP_TextIterator seems kind of wonky to me. Besides, I  
> don't really see any SPL_ prefixed classes, they are all either  
> *Iterator or *Object. I could argue that Perl or Python don't do this  
> prefixing, but I guess they do have namespace support.

> -Andrei




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

Reply via email to