Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41066 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22314 invoked from network); 15 Oct 2008 09:36:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2008 09:36:18 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:53013] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/97-19544-099B5F84 for ; Wed, 15 Oct 2008 05:36:17 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id 19ABC414400F; Wed, 15 Oct 2008 09:37:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fjoQc1f3HeAd; Wed, 15 Oct 2008 11:37:43 +0200 (CEST) Received: from [192.168.80.161] (unknown [195.226.16.50]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 7D4FB4144009; Wed, 15 Oct 2008 11:37:43 +0200 (CEST) Cc: Lester Caine , internals@lists.php.net Message-ID: <7C5A9831-9703-4DB5-B66C-83B61C3B7D7F@pooteeweet.org> To: Ron Rademaker In-Reply-To: <48F5B963.8000301@connectholland.nl> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Wed, 15 Oct 2008 11:35:43 +0200 References: <3CF765DF-27AF-44FD-9ECF-BEBFC8A0AFCA@pooteeweet.org> <48F5A349.4000909@lsces.co.uk> <48F5A4D6.2080904@connectholland.nl> <48F5B4D9.3030109@lsces.co.uk> <48F5B963.8000301@connectholland.nl> X-Mailer: Apple Mail (2.929.2) Subject: Re: [PHP-DEV] namespaces and alpha3 From: mls@pooteeweet.org (Lukas Kahwe Smith) On 15.10.2008, at 11:35, Ron Rademaker wrote: > Lester Caine wrote: >>> >>> What would be the advantage of wrapping legacy functions in a >>> namespace over wrapping them into a class as static functions? >> >> THAT is probably why I am asking the question? And may well be key >> to my understanding why converting non OO code into OO code in PHP >> is so problematic. When I was coding in CC++ more heavily libraries >> did not need to be objects and the 'namespace' just wrapped the >> code OR the code was built as an object. That is what I understand >> by a namespace, so perhaps I do not understand why leaving out >> functions and constants is acceptable :( > > I don't think there's any difference between moving non OO functions > to a class and making the static and moving those to a namespace (in > a suggested syntax it would be: Bar:::foo() for a namespace and > Bar::foo() already for a class). Even more, I think there are > advantages for moving a legacy app to a class because it allows you > to make your global variables (like things in legacy apps) class > members. Of course that's only an advantage if you agree that > globals are evil... > > So my conclusion would be that leaving out functions and constants > is acceptable because there's no advantage of having those in a > namespace. Classes already provide everything you would possibly > want from namespaces for functions and constants. well you cannot split a class definition across several files. so if you move your functions to a class, you need to move them all to a single file. regards, Lukas Kahwe Smith mls@pooteeweet.org