Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38680 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39715 invoked from network); 29 Jun 2008 22:06:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2008 22:06:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=lars@strojny.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lars@strojny.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain strojny.net designates 78.46.69.2 as permitted sender) X-PHP-List-Original-Sender: lars@strojny.net X-Host-Fingerprint: 78.46.69.2 milch.schokokeks.org Received: from [78.46.69.2] ([78.46.69.2:46844] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/E1-25765-D5708684 for ; Sun, 29 Jun 2008 18:06:24 -0400 Received: from [192.168.0.100] (xdsl-87-79-231-63.netcologne.de [::ffff:87.79.231.63]) (AUTH: PLAIN lars@schokokeks.org, SSL: TLSv1/SSLv3,256bits,CAMELLIA256-SHA) by milch.schokokeks.org with esmtp; Mon, 30 Jun 2008 00:06:17 +0200 id 000000000000C064.000000004868075A.000019BD To: Christian Seiler Cc: Dmitry Stogov , php-dev List , Andi Gutmans , Stanislav Malyshev In-Reply-To: <4863C299.1080002@gmx.net> References: <4856A547.3080801@gmx.net> <485A35A0.9050602@zend.com> <485AF253.2070400@gmx.net> <485B908D.7000106@zend.com> <4863C299.1080002@gmx.net> Date: Mon, 30 Jun 2008 00:04:50 +0200 Message-ID: <1214777090.11320.13.camel@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=_milch.schokokeks.org-6589-1214777178-0001-2" X-Mailer: Evolution 2.22.2 Subject: Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP From: lars@strojny.net (Lars Strojny) --=_milch.schokokeks.org-6589-1214777178-0001-2 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Christian, thanks again for your (and Dmitry's) great work on making closures a part of PHP. Am Donnerstag, den 26.06.2008, 18:23 +0200 schrieb Christian Seiler: > * I have *not* added any __invoke() magic to normal objects. This is > mainly due to the simple reason that adding that would not help > a closure implementation at all. Closures need some engine internal > magic (use a dynamically created op_array instead of looking one up, > setting the correct class scope and setting the correct EG(this). And > as I said: I want to stick with the closure basics for now. I understand that you want to keep your proposal basic. However I have the feeling that we need a complete implementation to make closures really beneficial for our users. I would consider the following features to be central for a feature complete implementation: * Class::__invoke() to allow functors[1]. The class "Closure" in your proposal should also implement that method to make method_exists() and ext/reflection behave. * Change the behaviour how method calls are resolved. Method calls on invokable objects (closures or functors) should work. cu, Lars [1] http://en.wikipedia.org/wiki/Functor [2] Example for a closure assigned to a property: class View(); { public $escape; } $view =3D new View(); $view->escape =3D function($string) { return htmlentities($string, ENT_QUOTES, 'UTF-8'); } echo $view->escape(""); --=_milch.schokokeks.org-6589-1214777178-0001-2 Content-Type: application/pgp-signature; name="signature.asc" Content-Transfer-Encoding: 7bit Content-Description: Dies ist ein digital signierter Nachrichtenteil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (GNU/Linux) iQIcBAABAgAGBQJIaAcCAAoJECQPF+sCY6wHqZ0P/jxY3WYmFEd2T6mESAXUPyti WDQGEOLJGstSrJ574QmsTQAZRtQmLebAykdU24PD6bBHiYeJuXZ+2FY1kQgt5zTb kodV6hQ/3sV902Qzbgk8Bze1jmiOSTOZxzgidjLD9+1cjPTJy8PzjI43gypYLxCr H2+ps213l26P4uP2t4av8dOfsyK6ueOrRSSUwNrv7Z67rV/SiM2wk0XlAf4jUFCR i0agYVY4WTsy2QEQJqdPdMgkNhKM9JiGto1dLE8xIXlE9GNef7I5DDZrA1qLFg3w hwfsaITaQZHwoMcF/8V5/0utJu1FI6Vgc/I8rFZUg/86KvdtMWZrjwRvDELr3oF7 e6f5c5PtGkHVLCgfJKWzILi96ugc3kvmeVmEo4aczawRsRmOaE2t8siEjQIUUnU3 w9XmlzDc+fTUbbx1ABK+7UIu+xmLQawcBDhoQOR5nxgkOygUuiQ/YkbAvr95G6n4 1tONn/V3y6OdGhblNy+czVrtM1BuZ5ICBfhLr8JbieoJuI92TmK6zofSdNghk4Ye T6ORcZpf3FY0j5MynTJ7NP4p6yyno9UIJ2jrjSXSiWzUCQI98ZHBNkhmoL2dZwmU 9aAd9q4wtRcE1hfv1sc/yRPLqOknXdz4eG2fE/8M5HKh8nU1RbdDuJb1xPInhFwI 7NwQ5WPvJU1ZscPVOCUi =mR9x -----END PGP SIGNATURE----- --=_milch.schokokeks.org-6589-1214777178-0001-2--