Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59000 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2585 invoked from network); 18 Mar 2012 10:56:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2012 10:56:21 -0000 Authentication-Results: pb1.pair.com header.from=vchkpw@developersdesk.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=vchkpw@developersdesk.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain developersdesk.com designates 204.228.229.4 as permitted sender) X-PHP-List-Original-Sender: vchkpw@developersdesk.com X-Host-Fingerprint: 204.228.229.4 lessa.developersdesk.com Received: from [204.228.229.4] ([204.228.229.4:40903] helo=mail.developersdesk.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/B2-18036-35FB56F4 for ; Sun, 18 Mar 2012 05:56:20 -0500 Received: (qmail 4498 invoked by uid 89); 18 Mar 2012 10:56:16 -0000 Received: from unknown (HELO ?10.1.1.5?) (vchkpw@developersdesk.com@67.61.98.111) by 0 with ESMTPA; 18 Mar 2012 10:56:16 -0000 Message-ID: <4F65BF57.9050803@developersdesk.com> Date: Sun, 18 Mar 2012 04:56:23 -0600 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Scalar-type-hinting - which way is the best to go? From: vchkpw@developersdesk.com (Rick WIdmer) On 3/17/2012 11:46 PM, Marco Pivetta wrote: > Thank you for clarifying some things :) > > >> 4. Strict weak type hinting: >> >> This realm is the most likely to succeed because the core already does >> something like this for internal functions (via zend_parse_parameters). >> This balances utility (enforcing the type) with fundamental language design >> principles (juggling). You need to understand the fundamental language >> principles to understand why any solution MUST lie somewhere in this realm. >> Remember that: >> 1.2 === "12"; >> "2"+"2" === 4; >> substr(12345, "2") === "345"; >> >> This type juggling affects the language in all sorts of ways. For example, >> PHP uses '.' for concatenation (not '+' like most similar languages) which >> ensures that there is no ambiguity as to whether you are operating against >> the integer value or the string value. PHP is designed so that you >> generally don't have to care whether a value is ACTUALLY an integer or a >> string internally, it will be treated as whatever type you use it as. In >> PHP int(2), float(2.0), and string("2") can generally be used completely >> interchangeably with no variation in results whatsoever. When core devs say >> that "strict typing would make it not PHP anymore", this is what they mean; >> it would badly violate this core concept. If you want scalar typing, you >> need a solution that embraces this fundamental design principle. >> >> > Yeah, I don't want to start a discussion on that now nor start a (probably > already repeated) war on it, but I think those principles are dead since > very long time... If you think that the essential core functionality of type juggling is "dead since very long time" you have no business making decisions on the future of PHP. PHP without type juggling is no longer PHP! Call my opinion extreme if you wish, but I believe Rasmus, the owner of the trademark on PHP, has suggested that he would not allow the name PHP to be used if it is removed. If you really, really want strong type in a PHP like language, please fork it, rename it, and go away! See if the market follows you or PHP.