On Fri, Jul 4, 2008 at 11:53 AM, Lars Strojny <[EMAIL PROTECTED]> wrote:
> Am Donnerstag, den 03.07.2008, 16:31 -0500 schrieb Travis Swicegood:
>> * Completely bike shedding, but does "Recursive" need its own level?
>> RecursiveArray reads better than having Array at two different levels
>> to me.
> Alright, I will change that.
>> * Again, bike shedding, but I like the name ArrayIterator - it
>> defines exactly what the class is while Array doesn't convey very
>> well by itself.  You have to look at the full name in order to
>> understand the process.  This also becomes ambiguous when you're
>> reading the code in PHP.  What does "$a = new Array($some_array);"
>> do?
> That's what "use" is for. You would do "use Spl::Iterator::Array as
> ArrayIterator" and than "new Array" becomes "new ArrayIterator" which is
> pretty clear. Of course, we should add that to the docs if we go that
> way.
>> You end up with more verbose names by going to a PEAR1 style of
>> naming convention because you have to use the entire name with the
>> namespace in order to convey what the code is supposed to be doing.
>> I would stick with names more closely related to the original names
>> and add "spl::" (see next comment for lowerspace) to signify that
>> they're part of SPL.  So instead of RecursiveArrayIterator, you have
>> spl::RecursiveArrayIterator; SplFileInfo becomes spl::FileInfo, etc.
> I see it more as packages. "Spl" is a package consisting of several
> subpackages like "Iterator", "Lists", etc. pp.

in this case, I think the following would be better as a naming scheme:


this way, class always has "meaningful name"
and subpackage is marked with trailing "s".
This would be easy to read from right to left "Queue which is one of
the Lists, which is one of the packages of SPL"

>> * I would change everything except the final class name in the full
>> name to be lowercase.  Using your existing examples:
>> Spl::List::DoublyLinked would be spl::list::DoublyLinked, or better
>> yet spl::DoublyLinkedList, etc.  This helps denote what is a class
>> and what is part of the namespace name.  In the original examples,
>> its ambiguous as to what can be instantiated.  Are Spl and Spl::List
>> classes that can be instantiated?  Moving to the lower space
>> convention makes it easy to denote what is a class and what is just
>> part of the namespace.  This follows the path created by several
>> other languages.
> I don't really have an argument against that, except that I honestly
> don't like it, sorry :). I'm not sure how I could assume that
> "Spl::List" can be instantiated, as I miss the hint that it exists. If
> Spl::List is a problem, everybody out there must have a hard time trying
> to figure out that there is no StringIterator because ArrayIterator
> exists?
> cu, Lars

Alexey Zakhlestin

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

Reply via email to