Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66518 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94070 invoked from network); 7 Mar 2013 08:54:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2013 08:54:26 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wg0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:63471] helo=mail-wg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/61-20037-1C558315 for ; Thu, 07 Mar 2013 03:54:25 -0500 Received: by mail-wg0-f53.google.com with SMTP id fn15so273982wgb.8 for ; Thu, 07 Mar 2013 00:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=b9HWgKIaavuCH/LFr0uw79G3RK6MMaMFrGDisHQ5BxY=; b=qIb4jX7FVch8mHUMP0c8n8YK5UPlGgUmbTBoThfbFGSqRgkYeSnkV1PcplPBvsF1sS k+OKur60c9GyhcX2dcUernuRw1EMG+WU4Q1i7gwvSpc51q8RqMazqivNIZCBZJvWdVE8 QO5Rm0yEu8HOm8KZju1U8quKWqKWbYNU7l01+11/v6mRS+aoQ+Vu45Ie1TJYEJhGPf43 e0l4JrdAKnD/z+OgMrQTgWhxeLDpwYlIqmbun9EY52OefhpFV8XfAaB93XuHDqQ2DzXp 6FMNacrrbgKZ8w7iwjc/HErdXA6UgnzPCMEugy5xd80a+kTnZw3l+BIJxK9/ji4QzjNr 3xog== X-Received: by 10.194.21.233 with SMTP id y9mr45716256wje.47.1362646462624; Thu, 07 Mar 2013 00:54:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.137.39 with HTTP; Thu, 7 Mar 2013 00:54:02 -0800 (PST) In-Reply-To: References: <5137D21C.1050907@sugarcrm.com> Date: Thu, 7 Mar 2013 09:54:02 +0100 Message-ID: To: Sebastian Krebs Cc: Stas Malyshev , Bob Weinand , PHP Mailing List Developers Content-Type: multipart/alternative; boundary=047d7b5d27745bfaf904d751da4a Subject: Re: [PHP-DEV] [RFC] unset(): return bool if the variable has existed From: ocramius@gmail.com (Marco Pivetta) --047d7b5d27745bfaf904d751da4a Content-Type: text/plain; charset=UTF-8 On 7 March 2013 09:45, Sebastian Krebs wrote: > > So I guess this is the only useful behaviour. However, I have no idea, what > this information should tell me. If I call unset() then I want to ensure, > that the variable is not set anymore, but for what reason I should need to > know, whether it was set before, or not? > I think I actually had an use case with proxies, where I wanted to know if a property was set or not. That's useful to reset the proxy state (basically to intercept property access) and differentiate null properties vs non existing properties: class Blah extends Blubb { protected $prop; public function __construct() { unset($this->prop); } public function init() { $this->prop = 'stuff'; } public function reset() { return unset($this->prop); } // we now know if `init` was called } This *could* be useful if I want to keep track of the state of a proxy, but it's just an additional property to keep track of manually on the other side. The additional property is also more explicit and easier to track. Yes, it needs a better use case. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --047d7b5d27745bfaf904d751da4a--