Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19325 invoked from network); 15 Oct 2008 09:33:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2008 09:33:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=ron@connectholland.nl; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ron@connectholland.nl; sender-id=unknown Received-SPF: error (pb1.pair.com: domain connectholland.nl from 81.4.92.194 cause and error) X-PHP-List-Original-Sender: ron@connectholland.nl X-Host-Fingerprint: 81.4.92.194 seoul.virtualbuilding.nl Linux 2.5 (sometimes 2.4) (4) Received: from [81.4.92.194] ([81.4.92.194:57019] helo=seoul.virtualbuilding.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/E6-19544-4E8B5F84 for ; Wed, 15 Oct 2008 05:33:25 -0400 Received: from localhost (localhost [127.0.0.1]) by seoul.virtualbuilding.nl (Postfix) with ESMTP id 7013B5A13D9; Wed, 15 Oct 2008 11:29:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at seoul.virtualbuilding.nl Received: from seoul.virtualbuilding.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YNCvqNVLEuJf; Wed, 15 Oct 2008 11:29:18 +0200 (CEST) Received: from [10.123.123.7] (82-204-104-166.fttx.bbeyond.nl [82.204.104.166]) by seoul.virtualbuilding.nl (Postfix) with ESMTPSA id 23C8B5A13D7; Wed, 15 Oct 2008 11:29:18 +0200 (CEST) Message-ID: <48F5B963.8000301@connectholland.nl> Date: Wed, 15 Oct 2008 11:35:31 +0200 User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Lester Caine , internals@lists.php.net References: <3CF765DF-27AF-44FD-9ECF-BEBFC8A0AFCA@pooteeweet.org> <48F5A349.4000909@lsces.co.uk> <48F5A4D6.2080904@connectholland.nl> <48F5B4D9.3030109@lsces.co.uk> In-Reply-To: <48F5B4D9.3030109@lsces.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] namespaces and alpha3 From: ron@connectholland.nl (Ron Rademaker) 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. Ron