Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53082 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89278 invoked from network); 6 Jun 2011 21:18:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2011 21:18:59 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 207.97.245.143 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 207.97.245.143 smtp143.iad.emailsrvr.com Linux 2.6 Received: from [207.97.245.143] ([207.97.245.143:53230] helo=smtp143.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/91-23189-1444DED4 for ; Mon, 06 Jun 2011 17:18:59 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp54.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 73B522B0363; Mon, 6 Jun 2011 17:18:55 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp54.relay.iad1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 8B32E2B0734; Mon, 6 Jun 2011 17:17:10 -0400 (EDT) Message-ID: <4DED43D4.4070006@sugarcrm.com> Date: Mon, 06 Jun 2011 14:17:08 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Hannes Magnusson CC: PHP Development References: <4DED3A29.1090209@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Callable typehint From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Like I mentioned in the other thread (which I probably should had > repeated here), a lot of libs/frameworks are using the 'Closure' > typehint for callbacks. Well, they are wrong (unless they mean to use only closures and not callbacks). But that's no reason to do wrong thing in the language too. > The problem with that is a function name as a string and > array("classname", "functionname") are considered is_callable(). > To get through the intentions of the Closure hint, I would have to > wrap the actual callback in a closure - which doesn't make any sense. "callable" is not actually even a type. If we make it a language construct, then why 'authenticated DB connection', 'name of readable file', 'valid stream URL', 'validated XML', 'string in UTF-8 no longer than 255 characters' or 'balanced binary tree' is not a language construct? I don't think we need to put every data check into the language, especially that it actually makes it worse - you can gracefully handle user-space check, but not a strict typing error. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227