Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37856 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62549 invoked from network); 25 May 2008 08:57:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2008 08:57:18 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; 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:61488] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/25-21001-DE929384 for ; Sun, 25 May 2008 04:57:18 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 25 May 2008 11:58:27 +0300 Received: from [192.168.17.31] ([192.168.17.31]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 25 May 2008 01:58:24 -0700 Message-ID: <483929DC.2060606@zend.com> Date: Sun, 25 May 2008 03:57:00 -0500 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Marcus Boerger CC: Chris Stockton , Felipe Pena , internals@lists.php.net References: <46ccd1ab0804170742g142ed562t4f03339da549a820@mail.gmail.com> <48077BD2.2000107@zend.com> <48078168.1070801@zend.com> <496536410.20080525103752@marcus-boerger.de> In-Reply-To: <496536410.20080525103752@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 May 2008 08:58:24.0538 (UTC) FILETIME=[7D5DCFA0:01C8BE45] Subject: Re: [PHP-DEV] [RFC] Strict type hints (parameter and return value) From: stas@zend.com (Stanislav Malyshev) Hi! > as this seems to be your only argument throughout the discussion, I > suggest we implement is_numeric() and alike or allow a second parameter > that to 'is_*($vaue, $strict=true)' that allows to switch to non strict > mocde. We then could easily allow 'numeric' as another type hint. Or in I see absolutely no use in "strict" mode. Moreover, I consider it harmful as it teaches people not to use dynamic nature of PHP but instead pepper their code with unnecessary checks and irrelevant errors. As I said, I see no difference that could matter to PHP programmer between '1' and 1, and I don't see why we should encourage making this difference. I know there could be very special cases when it could matter, but importance and frequency of such cases do not warrant, in my opinion, their support by the syntax and the standard library of the language. > other words I see this as a completely separate discussion. There are > two discussions: > a) do we want native type hints > b) do we want an easy ability to deal with compatible types in type hinting Just for the record: a) I think the whole idea of type hints, especially with primitive types, goes to a wrong direction - PHP is not a strictly typed language, and shouldn't be. b) However, on practical grounds, since we already have type conversion for internal functions, it won't be too much trouble for a user functions to do the same. On the other hand, making strict types for PHP functions is nothing but trouble, IMO. This is why I think it is not as separate as you think. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com