Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63651 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45243 invoked from network); 26 Oct 2012 14:56:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Oct 2012 14:56:20 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.131 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.131 smtp131.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.131] ([67.192.241.131:40341] helo=smtp131.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/47-00401-394AA805 for ; Fri, 26 Oct 2012 10:56:20 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp29.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id E86D039850D; Fri, 26 Oct 2012 10:56:16 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp29.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id B461C3984C7; Fri, 26 Oct 2012 10:56:15 -0400 (EDT) Message-ID: <508AA48D.5010903@sugarcrm.com> Date: Fri, 26 Oct 2012 16:56:13 +0200 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Clint Priest CC: PHP Developers Mailing List References: <508A68B9.1050801@zerocue.com> In-Reply-To: <508A68B9.1050801@zerocue.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : isset / unset "failable" From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > 1. If all cases can be tested for during compilation, prefer > compile failures. Not likely. isset($foo->$bar) is completely opaque since we don't know what $foo or $bar is. > 2. Let the compilation occur and at runtime when a disallowed > action is attempted, emit a warning and move on. > 3. As is currently, either at compilation or at runtime we issue a > fatal error and stop execution (probably least preferable if at runtime) Actually, I think the right way is: 4. On isset(), if the value can be retrieved, return true. Otherwise, return false (including the case when the value can not be retrieved because of missing getter). Same holds for empty() but in reverse - if isset() would return false, it'd return true and vice versa. On unset($foo->bar), act exactly as if the code were $foo->bar = NULL; Of course, this applies only for automatic definition of isset/unset. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227