Comments for "NameScheme"

» Submit Your Comment
Comments are only accepted during the "Proposal" phase. This proposal is currently in the "Finished" phase.
» Comments
  • Dmitry Koterov  [2004-06-06 11:53 UTC]

    Some comments about PHP5's __autoload() usage:

    [code]class PEAR_NameScheme_Autoload {
    # static void classAutoloader(string $classname)
    static function classAutoloader($classname) {
    $fname = PEAR_NameScheme::name2path($classname);
    if ($f = @fopen($fname, "r", true)) {
    return include_once($fname);
    return false;
    fuction __autoload($cls) {
    return PEAR_NameScheme_Autoload::classAutoloader($cls);

    Here $classname is ALWAYS passed in lowercase, so we need to manually search for class file in include_path. PEAR_NameScheme helps. (PEAR_NameScheme_Autoload is not proposed now, it is used here as example.)
  • Andrey Demenev  [2004-06-06 13:09 UTC]

    At present time, some packages do not respect naming standards you rely
    on. Just take a look at these classes and corresponding paths:

    SOAP_Base_Object SOAP/Base.php
    OLE OLE/OLE.php

    Another gotcha:

    I have my include_path set to ./:/usr/lib/php. I have db.php and
    system.php in current directory. Call to PEAR_NameScheme::name2path('system', true)
    will return /current/dir/system.php, while it is supposed to be
    /usr/lib/php/System.php. Same for db.

    So, I don't see any use in this package. It would not do anything except a mess.
  • Dmitry Koterov  [2004-06-06 13:33 UTC]

    Andrey, if you call include_once "system.php" in your program, you also load ./system.php, not /usr/local/php/System.php. And even more — your code is not windows-compatible at all (because Windows loads files in case-insensitive mode) and bad because of that.

    About coding standarts — first let's vote, and in the case of positive mark I'll convert the package.
  • David Costa  [2004-06-06 13:35 UTC]

    You do need to comment at least each function for the docbook. This is not optional but a written standard see

    all your function declarations are wrong see

    also with no comments at all this is a -1 for me, as per my email:

    "I personally think that there is no such a thing that "code clear enough without any comment".
    Even if I do
    print_r ($this->Object);
    I would comment like // debugging the object X "

    Please check carefully the sample file and the Manual section on standards.

    David Costa
  • Dmitry Koterov  [2004-06-06 14:21 UTC]

    Aargh! Comments are done:

    But if this package will be totally discarded, all the commenting work was made in vain.
  • Louis Mullie  [2005-01-01 05:42 UTC]

    All files are 404. Please correct your links.

    Louis Mullie