Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47420 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47772 invoked from network); 19 Mar 2010 02:56:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2010 02:56:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.224 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.220.224 mail-fx0-f224.google.com Received: from [209.85.220.224] ([209.85.220.224:37105] helo=mail-fx0-f224.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/32-31664-6D7E2AB4 for ; Thu, 18 Mar 2010 21:56:22 -0500 Received: by fxm24 with SMTP id 24so77356fxm.23 for ; Thu, 18 Mar 2010 19:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=f147GBDq3lF8mnjdN168UY2ldf2F4zPcN7eWQ9IXlFg=; b=cKUGmPm8AcbVa8khRGS7tlTfh4bceZewLukHXthTIMSrVkIwJMTN+TEiO3eNKs+stm YJ9VPhRuuJBbNwbizCFcA/+VLShGdUls5j9abU8VsmHrwYrSPBvddJ6Lymealv9F3gK9 1TWQXkwllpiAwMdLV+OXwmvU0PX2SDvi4qplI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=cDWAdpqcyqN/E9F6XUjlf3kKj9dIcPPTaMWizJb16Mtaob3xw5zH3S8iVDIr/ynXJH bKu9v8k5fyN5lweLfoFWkeTfRPu8UYwUjFvCkspGwt29j+8Db6q4w5Rcy9kGN7X/ES5R XuFAkINLrIOHFkLbTInJUy0oOaZFWl2y/eJAk= MIME-Version: 1.0 Sender: ekneuss@gmail.com Received: by 10.87.44.20 with SMTP id w20mr945326fgj.26.1268967379464; Thu, 18 Mar 2010 19:56:19 -0700 (PDT) In-Reply-To: <4BA25919.8090805@easyflirt.com> References: <4BA0DF61.1010907@easyflirt.com> <4BA0E39C.7020600@gmail.com> <4BA0E9E8.8000404@easyflirt.com> <4BA1DB19.1080608@easyflirt.com> <660eb66f1003180224g5662ba1dtb123c3ee88a3a3e5@mail.gmail.com> <4BA25919.8090805@easyflirt.com> Date: Fri, 19 Mar 2010 03:56:19 +0100 X-Google-Sender-Auth: a765d7acd246a7e3 Message-ID: To: "mathieu.suen" Cc: Peter Lind , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Assign array with __get From: webmaster@colder.ch (Etienne Kneuss) On Thu, Mar 18, 2010 at 5:47 PM, mathieu.suen wrote: > Peter Lind wrote: >> >> On the contrary, it's quite obvious what's going on. In both examples >> __get() returns an array as PHP would normally do it (i.e. NOT by >> reference) which means that if you try to modify that you'll end up >> modifying nothing much. However, in your second example, the point at >> which you call __get() indirectly comes before the assign to the zork >> array - hence, the $this->zork['blah'] =3D 'blah'; no longer indirectly >> calls __get as object::$zork now exists. >> >> =A0In other words, this is down to you confusing passing a variable by >> reference and passing it by value: PHP normally passes arrays by >> value, so when __get() returns an array, you're working on a copy of >> the array you returned. As someone noted earlier, you can easily >> change the behaviour of __get to return variables by reference, should >> you want to. However, I personally wouldn't want this to be default >> behaviour as that would make debugging apps much more annoying - >> things should be consistent, even if consistency at times confuse >> people. >> >> Regards >> Peter >> >> > > The sementic of > > $this->zork > > Should be the same as > > $this->__get('zork') > $this->zork is only the same as $this->__get("zork") if zork is undefined, this is perfectly normal and expected. > So in that respect it is not consistent. > > But anywhere I don't care if =A0it change or not. > > Look at Scheme, Lisp and Smalltalk language. > This is what I call consistent language. > > > -- Mathieu Suen > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch