Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33713 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64365 invoked by uid 1010); 5 Dec 2007 04:36:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64350 invoked from network); 5 Dec 2007 04:36:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Dec 2007 04:36:33 -0000 Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:54218] helo=blobule.interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/1A-10080-DCA26574 for ; Tue, 04 Dec 2007 23:36:32 -0500 Received: by blobule.interjinn.com (Postfix, from userid 2000) id A19965AD64C; Tue, 4 Dec 2007 23:36:24 -0500 (EST) To: Larry Garfield Cc: internals@lists.php.net In-Reply-To: <200712042226.08192.larry@garfieldtech.com> References: <200712042226.08192.larry@garfieldtech.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: InterJinn Date: Tue, 04 Dec 2007 23:36:23 -0500 Message-ID: <1196829384.14915.6.camel@blobule> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Subject: Re: [PHP-DEV] RFC: Dropping Namespace From: robert@interjinn.com (Robert Cummings) On Tue, 2007-12-04 at 22:26 -0600, Larry Garfield wrote: > On Tuesday 04 December 2007, Derick Rethans wrote: > > > 4. What is wrong with simple prefixes in the first place? Both PEAR_*, > > Zend_*, ezc*, and ezp* are perfectly acceptable markers for different > > 'namespaces'. We could optionally create a registry on php.net for > > this to avoid conflicts. > > Although most people on the list seem to be coming at this problem assuming > classes, I want to offer a counter-example that is all functions. > > In Drupal, our plugin architecture is based on function naming. When a given > event "omg" occurs, something akin to the following frequently happens (a bit > simplified): > > $hook = 'omg'; > foreach ($modules_that_are_loaded as $module) { > $function = $module .'_'. $hook; > if (function_exists($function)) { > $return[] = $function(); > } > } > return $return; > > It's a very powerful mechanism, and quite flexible. The one thing it doesn't > offer is, given a function name, determine what module and hook/event it is > for. That's because we use PHP core coding standards, which say to use > function_name for all functions. So given this function name: > > views_do_stuff() > > Is that the "do stuff" hook from the "views" module/plugin, or the "stuff" > hook from the "views_do" module? Excellent question, and one that cannot be > reliably solved. (There is a module called "views", but nothing is stopping > anyone from writing a "views_do" module and declaring their own "stuff" > hook.) There ye have it! Namespace support is for people who didn't name their classes/functions properly. I'm not for or against it. Cheers, Rob. -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ...........................................................