Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53837 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90707 invoked from network); 11 Jul 2011 08:22:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2011 08:22:25 -0000 Authentication-Results: pb1.pair.com header.from=hannes.magnusson@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=hannes.magnusson@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:55568] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/28-41672-0C2BA1E4 for ; Mon, 11 Jul 2011 04:22:25 -0400 Received: by ywb6 with SMTP id 6so1342256ywb.29 for ; Mon, 11 Jul 2011 01:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=OgoeA6aeii24g0zOpxCI/7DR2Q37SJzovowXtasmFvs=; b=CTd854fUjBJvlspsdhujlofIgIuWHQVAbD1PDq0RZ3z8vKQXa0mF/E/ufVcpyIQjM9 lJiQXBCA03W2Y3ESdARorrrqlmihN2GoIJ69XLH6sp8QAZq91Aqf8Gygb3wFnI3MHOEE rXhJP93KFr3h1vj68r2By8DiJk6NJhLqU7eZU= MIME-Version: 1.0 Received: by 10.147.146.12 with SMTP id y12mr3570885yan.12.1310372542152; Mon, 11 Jul 2011 01:22:22 -0700 (PDT) Received: by 10.147.35.14 with HTTP; Mon, 11 Jul 2011 01:22:22 -0700 (PDT) In-Reply-To: <1310324547.4669.7.camel@guybrush> References: <4DED3D5B.6030307@oracle.com> <4DEE782E.1020605@sugarcrm.com> <1307489981.23373.31.camel@guybrush> <1307527464.3635.395.camel@guybrush> <1310324547.4669.7.camel@guybrush> Date: Mon, 11 Jul 2011 10:22:22 +0200 Message-ID: To: =?UTF-8?Q?Johannes_Schl=C3=BCter?= Cc: Stas Malyshev , "Matthew Weier O'Phinney" , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Callable type From: hannes.magnusson@gmail.com (Hannes Magnusson) 2011/7/10 Johannes Schl=C3=BCter : > Hi, > > On Wed, 2011-06-08 at 12:04 +0200, Johannes Schl=C3=BCter wrote: >> >> Having the behavior cleared I wonder how useful it is in practical >> terms. A class type hint guarantees me I can do a specific call to >> methods defined in the class/interface. The proposed type hint tells >> me >> I can call it in some way. It won't ensure that the signature is >> compatible with what I expect. >> >> =C2=A0 =C2=A0 function foo(callable $cb) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 $cb(); >> =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 foo("strpos"); // This one in fact is illegal but won't be >> prevented >> >> But maybe this doesn't matter as type hints purely serve documentation >> (as E_RECOVERABLE are useless unless we make them Exceptions ...) >> while >> even for documentation purpose more information is needed. > > Any comments to this? - I didn't see an answer before the votes were > opened. > Voting is open on this? I don't think I ever had the time to integrate all the Q&A from this thread to the RFC. If you typehint on Closure, you don't know if it takes 0 or 10 parameters either. I don't think that is the point to know that either. -Hannes