Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75515 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88497 invoked from network); 14 Jul 2014 22:54:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 22:54:03 -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 108.166.43.115 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.115 smtp115.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.115] ([108.166.43.115:45542] helo=smtp115.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/51-15121-A8F54C35 for ; Mon, 14 Jul 2014 18:54:03 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp15.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 867F93804A6; Mon, 14 Jul 2014 18:53:59 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp15.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 28D60380284; Mon, 14 Jul 2014 18:53:59 -0400 (EDT) X-Sender-Id: smalyshev@sugarcrm.com Received: from Stass-MacBook-Pro.local ([UNAVAILABLE]. [74.85.23.222]) (using TLSv1 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.2.4); Mon, 14 Jul 2014 22:53:59 GMT Message-ID: <53C45F62.8060509@sugarcrm.com> Date: Mon, 14 Jul 2014 15:53:22 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Andrea Faulds , Alexey Zakhlestin CC: PHP internals References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <16D48604-0C0A-4613-91A4-21392E3A2636@ajf.me> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > That is exactly what is being proposed though. People (including > Anthony himself, along with other proposals) have previously > suggested type hints which just casted. However, I don’t think this > is terribly useful. You can already do that really easily (`$foo = > (int)$foo;`), and it’s too lenient; the non-scalar type hints are > useful because they validate your types, and the scalar ones, while > casting, should validate to a degree. PHP is weakly typed language, and 100% of existing code is written under such assumption. If you mean to convert it to strictly typed language, it won't be PHP. If you mean to make one small piece of it strictly typed, while the rest is not, it would not give you the advantage of strict typing (since you still can not prove anything about your code beyond a very small piece of it) but give you all the disadvantages such as increased development effort, more boilterplate code, etc. > Keeping close to zpp would be nice, but zpp’s behaviour isn’t always > the most sensible and useful one, but we should try to keep somewhat > close to it. If zpp behavior is not sensible, we should change it. However, having consistent conversion rules is much better than have two sets of rules, each of which make only a little sense, and forcing users to guess by which set of rules they play each time. We have PHP.next where we can break things, if some things in ZPP make no sense, we can break them and fix them and have a good set of rules that does make sense. It is much better than having two of them. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/