Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58339 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34806 invoked from network); 29 Feb 2012 17:33:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Feb 2012 17:33:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.173 smtp173.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.173] ([67.192.241.173:49621] helo=smtp173.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/46-33921-B616E4F4 for ; Wed, 29 Feb 2012 12:33:32 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp7.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 4DD7A25810D; Wed, 29 Feb 2012 12:33:29 -0500 (EST) X-Virus-Scanned: OK Received: by smtp7.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id D7E7925804A; Wed, 29 Feb 2012 12:33:28 -0500 (EST) Message-ID: <4F4E6168.4080502@sugarcrm.com> Date: Wed, 29 Feb 2012 09:33:28 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: Anthony Ferrara CC: "internals@lists.php.net" References: <4F4DD837.9090705@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! >> However, assignment overloading does not seem viable to me. >> Also, I'm not sure how this is possible technically: $obj = {expression} is >> supposed to replace $obj with the result of the expression, not call methods >> on $obj. > > The engine already calls methods on $obj when that happens. That's > the set handler. It just happens that user classes have a null set > handler, which is why it works the way it does. Internal classes have > full ability to work this way... This is internal implementation detail. Having it in the guts of the engine is one thing, exposing it to the user is quite another. The engine can also access arbitrary memory addresses and write arbitrary data there, but we don't propose to let the user do the same in PHP. > Pedantic note: It already means different things. We have notices if > it's not set, and it behaves differently if references are involved. > So already we have a few different effects on what happens depending > on where and how $obj was defined. So I fail to see how this is > *that* much of a shift. Again, you seem to miss important differences here. Providing notices when something is wrong in the expression is one thing, changing semantics of assignment is quite another. Saying "because we have notices it's also OK to have completely different semantics" makes very little sense to me. > really what it can enable is really powerful. Additionally, the code > is already there, and there are already classes using that code > (SimpleXML for one). So it's not like it's introducing new > functionality, it's just exposing the existing functionality to be > leveraged by PHP land code... SimpleXML does not change semantics of assignment. It uses some engine trickery to achieve what it does but the semantics exposed to the user is simple and intuitive. You propose to create ability to introduce semantics which in its intended usage will be both counterintuitive and disagreeing with how the engine works now. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227