Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18422 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45842 invoked by uid 1010); 25 Aug 2005 13:00:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 45822 invoked from network); 25 Aug 2005 13:00:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Aug 2005 13:00:28 -0000 X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:33214] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 25/BC-28235-8E0CD034 for ; Thu, 25 Aug 2005 09:00:25 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j7PD0JAK017555; Thu, 25 Aug 2005 15:00:19 +0200 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j7PD0CRP017529; Thu, 25 Aug 2005 15:00:13 +0200 Date: Thu, 25 Aug 2005 15:00:11 +0200 (CEST) X-X-Sender: derick@localhost To: Stanislav Malyshev cc: PHP Developers Mailing List In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at jdi-ict.nl Subject: Re: [PHP-DEV] Property Overloading RFC From: derick@php.net (Derick Rethans) On Thu, 25 Aug 2005, Stanislav Malyshev wrote: > DR>>If nobody as any better idea on how to solve it I'd like to start > DR>>implementing it. > > Some questions about the RFC: > > 1. What exactly property public $x = 1; means? I.e., first of all, what > "1" means - does it mean that __get guarantees to return 1 on __get("x") > if it was never set? Uh? It's just a default value, which I now remember we can't do. So forget the " = 1" ;-) > Altogether, problem (1) by itself has much easier solution - just add a > keyword (or fix existing keywords) to phpdoc/doxygen allowing to document > the thing without having language construct for it. I don't see why would > phpdoc require PHP engine support concept of virtual property in order to > document it. Afeter all, people routinely document code before even > writing it ;) Problem 1 is the least of the 3 problems, but introducing the keyword also helps solving the other two. > 2. I don't like having to go to reflection for finding out if it's defined > or not. Me neither, that's why I wrote it was a bad solution in the proposal ;-) > Also, would __have_prop be overridable and how it is different > from __isset existing now? If it's overridable, I don't see why PHP engine > needs anything to do with it - you always can write a method > and name it __have_prop and call it :) If it's not - you will be asked to > make it overridable almost instantly. So again I'm not sure what would be > PHP support for this thing. If I'm not wrong, __isset() checks if something is *set* not if it's available. The reason for __have_prop() is to check whether something is declaread as "property" in the class. There is no other way of doing that unless we'd like to break BC. > 3. I recognise that there is a problem with __handlers diagnostics, but I > don't see how returning true/false would help you - you wan't know what > failure 'false' means still - what if there's another failure besides > property not existing in __handler? If it returns false, the engine can throw an error on the line where it was used, not inside the __get() method itself, as that doesn't help debugging your code (as you don't usually know where it was called from). Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org