Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66541 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56266 invoked from network); 7 Mar 2013 20:10:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2013 20:10:20 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 157.55.1.143 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 157.55.1.143 dub0-omc2-s4.dub0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [157.55.1.143] ([157.55.1.143:34476] helo=dub0-omc2-s4.dub0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/4A-31723-B24F8315 for ; Thu, 07 Mar 2013 15:10:20 -0500 Received: from DUB108-W24 ([157.55.1.136]) by dub0-omc2-s4.dub0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Mar 2013 12:10:16 -0800 X-EIP: [1Bmjz/KjCsETqRCBkpuB0wPEeu+XK4GA] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_3fbfbdac-2dba-4e3d-b442-f884a11a8b61_" To: Date: Thu, 7 Mar 2013 21:10:16 +0100 Importance: Normal In-Reply-To: References: <5137D21C.1050907@sugarcrm.com> <5138F124.4090702@sugarcrm.com>, MIME-Version: 1.0 X-OriginalArrivalTime: 07 Mar 2013 20:10:16.0081 (UTC) FILETIME=[C8946010:01CE1B6F] Subject: FW: [PHP-DEV] [RFC] unset(): return bool if the variable has existed From: bobwei9@hotmail.com (Bob Weinand) --_3fbfbdac-2dba-4e3d-b442-f884a11a8b61_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable cc'ing the internals __ Am 07.03.2013 um 20:57 schrieb "Stas Malyshev" : > Hi! >=20 >> The main practical value is in the __unset magic method. You can now >> communicate through the "proper" way of a language construct with an >> __unset method. (success or failure) >=20 > I'm not sure how useful is that based on your example - unset could > throw the exception as well... And the whole case seems still unclear - > what is "false" supposed to mean in general case? Property didn't exist? > Property can not be unset due to special semantics? > --=20 > Stanislav Malyshev=2C Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 Take for example the unset method of a framework. Which return false. Then = you have an abstraction layer which converts the false into an exception. Y= es=2C in this simple use case it may be better to throw the exception direc= tly. But as you begin to introduce these well-known design patterns there m= ay appear some sense... Unset returns false if there was nothing to unset or if an unset_dimension/= property handler has returned false. Short: It doesn't return true if nothi= ng was successfully unset. Bob Weinand = --_3fbfbdac-2dba-4e3d-b442-f884a11a8b61_--