Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80650 invoked from network); 10 Aug 2010 22:46:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2010 22:46:46 -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 67.192.241.183 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.183 smtp183.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.183] ([67.192.241.183:42515] helo=smtp183.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/C5-61991-4D6D16C4 for ; Tue, 10 Aug 2010 18:46:45 -0400 Received: from relay8.relay.dfw.mlsrvr.com (localhost [127.0.0.1]) by relay8.relay.dfw.mlsrvr.com (SMTP Server) with ESMTP id 8DB3540165; Tue, 10 Aug 2010 18:46:41 -0400 (EDT) Received: by relay8.relay.dfw.mlsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 46F624003B; Tue, 10 Aug 2010 18:46:41 -0400 (EDT) Message-ID: <4C61D6D0.90907@sugarcrm.com> Date: Tue, 10 Aug 2010 15:46:40 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: Derick Rethans CC: Internals References: <1281478269.6608.292.camel@guybrush> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Strict typing (was: Typehints) From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > 1. right now we *have* strict type checks for classes and arrays in the > form of "classname" or "array" Because classes and arrays were never intechangeable types and there was never implicit or explicit conversion between SplRecursiveTreeIterator and Zend_Pdf_Generator - it doesn't even make sense to suggest it. There always was conversion between int and string or int and bool. These two things are completely different. > 2. the strict scalary type hint patch reuses this same syntax in the > form of to do the same thing in function arguments It's not a good thing. As I mentioned, primitive types and classes are very different in their use cases and established patterns in PHP. Primitive types are largely interchangeable, classes are not. (As for arrays, arrays really should be a class by their usage patterns etc. but for historic reasons... you know) > 3. we have casting type hints in the rest of the code in the form of > "(int)". Just to make it simpler and less confusing, of course. It's nothing like language having two features that look almost exactly the same but work in different way, and using plenty of ()s is an added bonus for all Lisp fans out there. > Some people don't like strict typehints, but the syntax as it currently > is regarding type hints is *consistent*. Now, to allow both strict and > casting hints, the logical step seems to be, to give the weak typehint > advocates their tool as well: Calling something that works completely differently from all the established patterns of PHP - like internal functions, etc. - "*consistent*" requires totally new definition of this word. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227