Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42392 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77031 invoked from network); 29 Dec 2008 00:18:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Dec 2008 00:18:05 -0000 Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.154 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.g.stan@gmail.com X-Host-Fingerprint: 72.14.220.154 fg-out-1718.google.com Received: from [72.14.220.154] ([72.14.220.154:9645] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/69-18017-A3718594 for ; Sun, 28 Dec 2008 19:18:03 -0500 Received: by fg-out-1718.google.com with SMTP id 16so1556107fgg.23 for ; Sun, 28 Dec 2008 16:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=Ny1jhbiKfw3lD743BfRJDkcP0HOaM4vey7YOPOvvPmg=; b=cfDNF0p9z55lFAlO9PoO/nE2dZH1TmsgFwc4dI7brGF78OHMSmk3W+rjfFu3hr3m0Z 5lJBRFbK8bJfhDzC5U3TP3p3Tn6QSMFCIudolY0SKilIQA6yNKPj6kZvFPvdjhVC7LSa Tv3Y9lwqXV0BxCgw2nxl1oYyv9OYHqGeV/lWM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=O4nehrp34wILfAm2GZ4w4/FghdkvDTezNuwqxVubpZ6Y9t803/Sze+zid+FeC4LSvG iEGO35gxHJneRlEHYFQmPi6JWz4j/RgdEWNcASCg6+w9BGjh07eATxPznoYki/5eSPuz Ugc4SZepC6l9N+Rg++9PouZp7Ciq0vjD9fXms= Received: by 10.86.91.12 with SMTP id o12mr7780165fgb.16.1230509879959; Sun, 28 Dec 2008 16:17:59 -0800 (PST) Received: from ?86.106.195.153? (86-106-195-153.stedu.ro [86.106.195.153]) by mx.google.com with ESMTPS id l12sm18745177fgb.8.2008.12.28.16.17.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Dec 2008 16:17:58 -0800 (PST) Message-ID: <49581746.9050401@gmail.com> Date: Mon, 29 Dec 2008 02:18:14 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20081204 Thunderbird/3.0b1 MIME-Version: 1.0 To: Lars Strojny CC: =?UTF-8?B?RGF2aWQgWsO8bGtl?= , PHP Internals References: <08AA10DA-2704-415C-8A8C-893C89990DC1@bitextender.com> <1230181883.12121.9.camel@localhost> In-Reply-To: <1230181883.12121.9.camel@localhost> Content-Type: multipart/alternative; boundary="------------080705080507070100030202" Subject: Re: [PHP-DEV] __invoke() weirdness From: ionut.g.stan@gmail.com (Ionut Gabriel Stan) --------------080705080507070100030202 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit PHP written in a JavaScript style is already possible with PHP 5.3. I started a little thread about this on a forum but didn't get that much feedback: http://www.sitepoint.com/forums/showthread.php?t=565576 It's not really what we're used to in JavaScript but it's very close. On 12/25/2008 07:11, Lars Strojny wrote: > Hi David, > > Am Dienstag, den 23.12.2008, 17:02 +0100 schrieb David Zülke: > [...] > >> This gives a fatal "Call to undefined method DateTime::getAtom()" >> $d = new DateTime(); >> $d->getAtom = Curry::create(array($d, 'format'), DATE_ATOM); >> echo $d->getAtom(); >> > > This is the same as the following: > > $obj = new stdClass(); > $obj->method = function() { > return "foo"; > }; > $obj->method(); > > The first "method" is a property, the call to "method" is - well - a > method call. Because PHP separates methods and properties in the class > entry structure - and because we have magic methods like __set, __get > and __call, there is no efficient and logical way how to search for > properties with closure instances when a method is not found. We > discussed that before and decided to let closures go out into the wild > and think about adding a solution for prototype alike inheritance later. > > cu, Lars > --------------080705080507070100030202--