Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34438 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95314 invoked by uid 1010); 4 Jan 2008 18:23:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95298 invoked from network); 4 Jan 2008 18:23:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 18:23:51 -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:26370] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/88-63281-5B97E774 for ; Fri, 04 Jan 2008 13:23:49 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Jan 2008 20:23:45 +0200 Received: from [192.168.16.90] ([192.168.16.90]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 4 Jan 2008 10:23:42 -0800 Message-ID: <477E79AE.6050407@zend.com> Date: Fri, 04 Jan 2008 10:23:42 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Stefan Esser CC: internals Mailing List References: <477DB7BF.10201@chiaraquartet.net> <20080104105558.GC7861@mint.phcomp.co.uk> <477E5649.2080104@chiaraquartet.net> <477E619C.2050107@sektioneins.de> In-Reply-To: <477E619C.2050107@sektioneins.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Jan 2008 18:23:42.0156 (UTC) FILETIME=[EF2F18C0:01C84EFE] Subject: Re: [PHP-DEV] type hinting From: stas@zend.com (Stanislav Malyshev) > * the code gets smaller because not so many typechecks in every function What do you mean "not so many"? You need one per checked parameter. > * because the code gets smaller it is faster executed (userspace > typecheck is slower than "engine-space") If you need single-opcode-level speedups, you probably better off to reimplement the same function in C. If we ever discover the speed of is_integer is a huge problem, we can make it an operator. However, I so far didn't see any evidence of that. > * with type hints byte code optimizer can optimize the code far better Do you have any optimizer that can do that? Any plans to make one? Any tests showing you can optimize real-life application this way? > * with type hints static analysing tools that check for > bugs/vulnerabilities can perform far better (intra procedural analysis > gives more information) That is true, type hints do make static analysis easier - strict typing is created exactly for that purpose. However, it only helps if all the code is strictly typed - otherwise you just move point of failure around. And in any case, type won't help you much form most real static analysis purposes, such as security - "string" can hold anything. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com