Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40528 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43262 invoked from network); 16 Sep 2008 10:12:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2008 10:12:29 -0000 Authentication-Results: pb1.pair.com header.from=jochem@iamjochem.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jochem@iamjochem.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: jochem@iamjochem.com X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 Received: from [194.109.193.121] ([194.109.193.121:56129] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/58-30574-7868FC84 for ; Tue, 16 Sep 2008 06:12:24 -0400 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id DC472287018; Tue, 16 Sep 2008 12:12:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at moulin.nl Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (mx1.moulin.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4rUpB9dAObMK; Tue, 16 Sep 2008 12:12:05 +0200 (CEST) Received: from [192.168.1.72] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id 8E07F286FE9; Tue, 16 Sep 2008 12:12:05 +0200 (CEST) Message-ID: <48CF8675.9040206@iamjochem.com> Date: Tue, 16 Sep 2008 12:12:05 +0200 User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: Vesselin Kenashkov CC: Karsten Dambekalns , internals@lists.php.net References: <66DC865A-1910-46E4-AEB5-37BE62D2417A@typo3.org> <261daaa10809151520s6c3f5adfld10004d8c408f301@mail.gmail.com> <48CEEB4D.2050505@iamjochem.com> <261daaa10809160144y3e2d6641y9b23632ac03f2495@mail.gmail.com> In-Reply-To: <261daaa10809160144y3e2d6641y9b23632ac03f2495@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Reply on "Who is using namespaces in PHP already?" From: jochem@iamjochem.com (Jochem Maas) Vesselin Kenashkov schreef: > We had no issues related to the namespaces (well we found & reported some > minor bugs, but not related to the namespaces). to be clear, your not using namespaced functions or constants? and your not using any classes that are not namespaced? how are you handling usage of internal classes? > Of course we have one namespace per file, having the file structure > following the namespace structure. As well, as Karsten mentions, converting > some_class_name_new to some::class::name::new is not an option. > We had no issues with the name resolution and no confusion so far on how to > use the namespaces. In fact, we have a complex autoload procedure that > follows the directory/namespace hierarchy to load/create (yes we generate > some) classes. No issues with the autoload so far. Just one note: you > should not throw Exceptions during the all autoload process, not just the > __autoload function. true, although you can actually successfully throw an exception from within autoload to the scope that triggered the autoload ... it's a bit of a WTF, there is also a workaround that uses eval to generate a class (when the class isn't found) that does nothing except throw exceptions upon init, static calls etc ... so that the code trying to use the non-existent class does actually get a class of the given name but using it *always* results in an exception (e.g. AutoLoadException or UnknownClassException) > I haven't checked the releases in the last month so > this might have changed. Besides the namespaces, our internal framework uses > in it fundamentals the Late Static Binding (for creating singletons and > providing the static method get_instance ). are you in a position to offer a few bits of example code to demostrate how/what your doing with respect to namespaces. I'm in the process of gathering material in order to compile a 'best practices' guide for namespaces ... I believe that there is a strong need to educate users in general on how/what/why to do things a certain way with namespaces (I include myself in that group of users!) ... maybe some of your implementation details could help educate others? > In overall I can say that php 5.3 is highly anticipated (both because of the > namespaces and LSB). I'm reading the ongoing discussions and proposals for > support for multiple namespaces per file but this I think will delay 5.3. My > opinion is that php 5.3. has to be finally released even with limited > support for namespaces. It can be followed immediately with another release > with the extended namespace support (this way many users will switch to > namespace support although some CMS/frameworks will not because for > optimization reasons they combine files). 5.3 was delayed enough already... your using alpha software in production, understandbly your hoping nothing changes and that it's released asap. but really your on the bleeding edge, some blood is to be expected. I don't actually think either LSB or namespaces is that highly anticipated in the larger arena, I think users like yourself and I are in a minority in that respect. I also think that uptake of these features will be modest at best, many developers/projects require that their code runs on older versions (even to the point of still supporting php4) which makes applying these new features impossible for them. > Vesselin Kenashkov > > > On Tue, Sep 16, 2008 at 2:10 AM, Jochem Maas wrote: > >> Vesselin Kenashkov schreef: >> >>> Hi, >>> >>> At our company the majority of the projects in the last 4 months are using >>> namespaces (we can afford using dev version of php, because we host the >>> projects). >>> Just to add my +1 into the count. >>> >> care to elaborate? what are your experiences? have you run into any >> trouble? >> have you developed a list of do's and dont's? (as Karsten has) >> >> >> >>> Vesselin Kenashkov >>> >>> On Mon, Sep 15, 2008 at 5:26 PM, Karsten Dambekalns >>> wrote: >>> Hi. >>>> Lukas asked on his Blog, so here goes my answer. >>>> >>>> We switched to namespaces last week for FLOW3 and all related packages. >>>> See >>>> http://forge.typo3.org/repositories/revision/21/1210 for the needed >>>> changes and >>>> http://forge.typo3.org/wiki/flow3-overview/Notes_on_using_PHP_namespacesfor >>>> some notes on the implications. >>>> >>>> Currently we don't have any problems with use statements, as we still >>>> have >>>> fully qualified names almost everywhere, thus autoloading works as >>>> expected. >>>> >>>> Still, looking into the future I'd love to see an enhancement as proposed >>>> by Greg in http://marc.info/?l=php-internals&m=121527668606247 plus some >>>> way to get rid of having to use single classes if I could use some >>>> wildcard >>>> instead. >>>> >>>> Regards, >>>> Karsten >>>> -- >>>> Karsten Dambekalns >>>> Gimme Five! >>>> http://typo3.org/gimmefive >>>> >>>> >>>> >>>> >