Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42424 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84554 invoked from network); 31 Dec 2008 17:59:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Dec 2008 17:59:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=lstrojny@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lstrojny@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 78.46.69.2 as permitted sender) X-PHP-List-Original-Sender: lstrojny@php.net X-Host-Fingerprint: 78.46.69.2 milch.schokokeks.org Received: from [78.46.69.2] ([78.46.69.2:52486] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/B0-01584-1F2BB594 for ; Wed, 31 Dec 2008 12:59:15 -0500 Received: from [192.168.0.100] (static-87-79-91-235.netcologne.de [::ffff:87.79.91.235]) (AUTH: PLAIN lars@schokokeks.org, TLS: TLSv1/SSLv3,256bits,CAMELLIA256-SHA) by milch.schokokeks.org with esmtp; Wed, 31 Dec 2008 18:59:10 +0100 id 000000000000C007.00000000495BB2EE.000029A1 To: Marcus Boerger Cc: David =?ISO-8859-1?Q?Z=FClke?= , PHP Internals In-Reply-To: <868073456.20081231173818@marcus-boerger.de> References: <08AA10DA-2704-415C-8A8C-893C89990DC1@bitextender.com> <868073456.20081231173818@marcus-boerger.de> Date: Wed, 31 Dec 2008 18:59:08 +0100 Message-ID: <1230746348.25966.3.camel@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=_milch.schokokeks.org-10657-1230746351-0001-2" X-Mailer: Evolution 2.24.2 Subject: Re: [PHP-DEV] [RFC] Re: [PHP-DEV] __invoke() weirdness From: lstrojny@php.net (Lars Strojny) --=_milch.schokokeks.org-10657-1230746351-0001-2 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Markus, have you measured the performance impact in a class with - say - ten methods? And what to do with __get() and __call()? How are the prioritized in the method resolve order? cu, Lars Am Mittwoch, den 31.12.2008, 17:38 +0100 schrieb Marcus Boerger: > Hello David, >=20 > Tuesday, December 23, 2008, 5:02:43 PM, you wrote: >=20 > > Hi folks, >=20 > > I played with __invoke today: >=20 > > class Curry > > { > > protected $callable; > > protected $args; >=20 > > public static function create($callable) > > { > > $curry =3D new self($callable, array_slice(func_get_args(), 1)); > > return $curry; > > } >=20 > > protected function __construct($callable, $args) > > { > > $this->callable =3D $callable; > > $this->args =3D $args; > > } >=20 > > public function __invoke() > > { > > return call_user_func_array($this->callable, array_merge($this-=20 > >>args, func_get_args())); > > } > > } >=20 > > However, it doesn't work consistently. >=20 > > This works fine: > > $d =3D new DateTime(); > > $getAtom =3D Curry::create(array($d, 'format'), DATE_ATOM); > > echo $getAtom(); >=20 > > This gives a fatal "Call to undefined method DateTime::getAtom()" > > $d =3D new DateTime(); > > $d->getAtom =3D Curry::create(array($d, 'format'), DATE_ATOM); > > echo $d->getAtom(); >=20 > > Is that intentional? >=20 > So far it is. Yet I as much as you do not like the inconsistency. So I > spend a little bit on providing the following patch that should do what > you were looking for. >=20 > The disadvantage: Calling properties is case sensitive while calling > methods isn't. But since this has nothign to do with this patch and the > patch only increases consistency I am all for applying it. >=20 > Comments? Lukas/Johannes? >=20 > Oh I hate that case insensitivity.... and inconsistency.... >=20 > > Cheers, >=20 > > David >=20 >=20 >=20 >=20 >=20 > Best regards, > Marcus > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, v= isit: http://www.php.net/unsub.php --=20 Jabber: lars@strojny.net Weblog: http://usrportage.de --=_milch.schokokeks.org-10657-1230746351-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 v2.0.9 (GNU/Linux) iQIcBAABAgAGBQJJW7LsAAoJECQPF+sCY6wH2foP/2ZBIY7PG199mzuMjXQFz0l+ yQh1JtN+Fyl7DyYCvVsXy36SHOsv2odhTxnfVI2u+nvujWZS8AEY6B00X7QQhkdh HnDomor1W4ZadbnUSICaCDlsySsUui25iAOzV1Ov/wWmPYpkuKenk57ft/QM1E/t hrhk/PFxk8uACKPoNrQvpiVFD/FQgtofBL0x4CqWNQuR9+wZ1YH2HHrsoJ0WbW9S HZFM5tk/iKuDe0cYpGDMMOSm6GZmLzj17MqzijRZas9yByZcrmpKPzPgIvoYmfU4 BOrOX7sQUW+gVOp1G/7F1VVa+/6hoiATlD6N0wGkIs9n0k1x/3vlstcx4Fauoc/m s9/h3xKfOQyWRx+jrhIRWo4FiSUNO4ru3MYDijRIeXRHm2toYxgySnqoRcDYEjak Sa/8ZW3J3bYS9mg0lO/QVxis6DaPzlfGVBkSTHXCtcbORF9bFmURDlI71LBARawI dp2nyrHk6eriKAg2YVvQu9N9ySNLLYsag7e5iV998zvpd98LBcQBLybG3iSHvI3C FMKUI5YOvhmnVV6tUpdBXO8BIpZbBHBFHBCY6yR2297qgAlu13CSE6LIKpdStSm3 m/3DF90O55Xji53XWrTAS4Z37wcFRLEWhboLq6ijmO5uHPLQKH1Vau7PQqK81xdk nxh/WE/LP28/hVXvyLb5 =F40l -----END PGP SIGNATURE----- --=_milch.schokokeks.org-10657-1230746351-0001-2--