Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38298 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52066 invoked from network); 16 Jun 2008 21:03:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jun 2008 21:03:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:35533] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/AA-06776-225D6584 for ; Mon, 16 Jun 2008 17:03:31 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 17 Jun 2008 00:03:35 +0300 Received: from [192.168.16.110] ([192.168.16.110]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 16 Jun 2008 14:02:49 -0700 Message-ID: <4856D4EF.4000002@zend.com> Date: Mon, 16 Jun 2008 14:02:39 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Chris Stockton CC: internals@lists.php.net References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <48077BD2.2000107@zend.com> <48078168.1070801@zend.com> <496536410.20080525103752@marcus-boerger.de> <483929DC.2060606@zend.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Jun 2008 21:02:49.0486 (UTC) FILETIME=[55950AE0:01C8CFF4] Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: stas@zend.com (Stanislav Malyshev) Hi! > Maybe we should stop using the 1 and '1' argument, yes, they can be Maybe not, while there are people that fail to understand it. Here: > But try to remember, 1 !== '1' and PHP is not an end all language, often > we have to communicate to strictly type systems, we need to be positive So you just ignored the "special cases" part. Yes, if you have special case where you interface with very brain-dead strictly typed system that absolutely can't understand that '1' and 1 is the same - then you need to _convert_. So how failing when you get '1' instead of 1 helps you? You'd need _conversion_, not _failure_ - and if you write strictly-typed API, you'd move the conversion responsibility to the user, instead of having it where it belongs - in the API. That's *exactly* why I see strict typing in PHP so dangerous - it promotes lazyness and sloppiness in API writing, and those APIs will be a nightmare to use, since they would bomb out on slightest disagreement about internal engine types, which the API user shouldn't care about at all. What happened with "be liberal at what you accept"? In strict compiled languages, the compiler and IDE will guide you through this, in PHP you'd just have it explode in your face in production. How this is good for anybody? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com