Re: Why are the PHP namespaces different compared to C++?

From: Date: Fri, 07 Sep 2012 00:37:18 +0000
Subject: Re: Why are the PHP namespaces different compared to C++?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-62881@lists.php.net to get a copy of this message
Hi! > Yes, PHP namespaces are completely different from what you'd be used > to in C++. In all honesty namespaces were never well designed in PHP > and were implemented in a haphazard way, which is why I generally > don't bother using them. I just love how people assume if something does not fit their specific use case people implementing it must be stupid and didn't bother to actually think about it. If only they gave it some though, they would definitely would do it exactly as you want. > To clarify, importing namespaces in PHP isn't like importing > namespaces in C++ at all, really. You are merely aliasing namespaces There's no importing namespaces in PHP, period. It is not "messy", it is by design, and if you bothered to read extensive discussions that happened on the list at the time, you'd know why. But of course who needs that. > It simply doesn't work like that because PHP's namespaces are > implemented in such a way that they don't really resemble namespaces. They do not resemble namespaces in C++. They resemble namespaces in PHP. That's because PHP is not C++. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#62881) next »