Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39559 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59782 invoked from network); 2 Aug 2008 17:36:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2008 17:36:31 -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 74.125.46.30 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: 74.125.46.30 yw-out-2324.google.com Received: from [74.125.46.30] ([74.125.46.30:15869] helo=yw-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/52-47668-B1B94984 for ; Sat, 02 Aug 2008 13:36:29 -0400 Received: by yw-out-2324.google.com with SMTP id 5so770722ywb.83 for ; Sat, 02 Aug 2008 10:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=fnAVxyBwXnMglTxbDNx0CrTL5q3BfuQqRNevx5D+KuU=; b=FOJt/wESKsou/YroHnzBDSAmm0HziTP2UeqQiB/iGhO093/2om/yht2V+QvFTYHmip 5GDo5CSAkgWMLWntFRL9VpR7lqasKDPTUXUE+pZ3t59ZkDcUvqnSSrwkSNYQogC086Aq o7zLAkVJjpr+mp61aqjDObPzBBKy7pwY4ocJw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=Ts9ZYWj2TuV8KYGYXwK+EB2P5xBD/jaDSilzLUFUe9HutshtagEPajgSQh/19/2Qm8 cHDfqNcU0E1g7z75JNYidhOLdMaDMRL9eXmsl7MgurNH2Ua2fpU1w6y495sIYBw1tBbR CsfwYGNGIyr8I6yg/HtwtTT/YZ5xnDBRo5I2s= Received: by 10.151.144.15 with SMTP id w15mr5336188ybn.200.1217698583654; Sat, 02 Aug 2008 10:36:23 -0700 (PDT) Received: by 10.150.197.14 with HTTP; Sat, 2 Aug 2008 10:36:23 -0700 (PDT) Message-ID: Date: Sat, 2 Aug 2008 19:36:23 +0200 Sender: ekneuss@gmail.com To: "PHP Internals List" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 585c38ac68d533c9 Subject: __invoke concerns From: colder@php.net ("Etienne Kneuss") Hi, this is probably not the best time to raise concerns about __invoke (closures) now that alpha1 is already realeased, but I believe it's worth it. 1) I don't believe that having it thrown as another of those magic method is a good idea. Rather, I'd like to have it represented by an interface: Invokable. That way, type hints/checks can be done in user land in a sane matter: function foo(Invokable $obj) { $obj(); } if ($foo instanceof Invokable) $foo(); etc.. 2) Do we really want __invoke's argument to be mapped to caller arguments. Providing an array of arguments, ala __call(Static) sounds more consistent. class A { public function __invoke($arg) {var_dump($arg); }} $a = new A; $a(1,2); // int(1), currently. IMHO it should be array(1,2) 3) Do we really want to allow both static and non-static versions of __invoke ? class A { public static function __invoke($args) { .. }} $a = new A; $a(); being a static call to __invoke doesn't make much sense to me. I hope these issues can be discussed and maybe addressed before a final 5.3 release. I'm willing to do patches for all three concerns if I sense a positive feeling towards this. Regards, -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal