This is an old revision of the document!
Request for Comments: How to write RFCs
- Version: 1.0
- Date: 2008-03-06
- Author: Lars Strojny firstname.lastname@example.org
- Status: Work in progress
- First Published at: none
This RFC discusses the transition to real namespaces for internal classes in e.g. ext/spl.
Why should we use namespaces for internal classes?
Currently internal classes are inconsistently named. Just take a look at SPL:
Some of the classes in ext/spl are prefixed with “Spl”, some are not. To avoid naming collisions and as a structural element, namespaces were introduced in PHP 5.3. This gives us a chance to move all the Spl-classes in appropriate namespaces. Take a look at the following transitions:
- RecursiveIterator: Spl::Iterator::Recursive
- RecursiveIteratorIterator: Spl::Iterator::Recursive::Iterator
- RecursiveRegexIterator: Spl::Iterator::Recursive::RegexIterator
- RegexIterator: Spl::Iterator::Regex
- RuntimeException: Spl::Exception::Runtime
- SimpleXMLIterator: Spl::Iterator::SimpleXML
- SplObserver: Spl::Observer::Observer
- SplSubject: Spl::Observer::Subject
- SplFileInfo: Spl::File::Info
- SplFileObject: Spl::File::Object
- SeekableIterator: Spl::Iterator::Seekable
Proposal and Patch
The hardest part of the proposal is to find a way not to break backwards compatibility. The old names will be present in PHP 5.3 and will be removed in PHP 6.