Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8266 invoked by uid 1010); 18 Oct 2007 16:32:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8251 invoked from network); 18 Oct 2007 16:32:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2007 16:32:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:47617] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/08-61918-E9A87174 for ; Thu, 18 Oct 2007 12:32:32 -0400 Received: from localhost (h1149922.serverkompetenz.net [85.214.94.56]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id B6C101B3657; Thu, 18 Oct 2007 18:32:27 +0200 (CEST) Date: Tue, 16 Oct 2007 02:32:49 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <345136958.20071016023249@marcus-boerger.de> To: Umberto Salsi CC: internals@lists.php.net In-Reply-To: <200710151236.l9FCaPIg014853@icosrv.icosaedro.it> References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C8@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7CB@s1.mkj.lan> <4712731B.5070501@zend.com> <200710151236.l9FCaPIg014853@icosrv.icosaedro.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: AW: [PHP-DEV] Method overloading by method signature From: helly@php.net (Marcus Boerger) Hello Umberto, Monday, October 15, 2007, 3:36:22 PM, you wrote: > Posting to newsgroup php.internals, Stanislav Malyshev wrote: >> > only reason to use type hints - to ensure the method is used >> > correctly and build more robust applications), it is better to tell >> >> BTW, I'm not sure how exactly it makes the code more robust - if you >> call it with wrong type and it's not checked, the app would probably die >> on fatal error. If you call it with wrong type and it is checked, the >> app would die on fatal error couple of lines above. Unless you use some >> kind of static analysis tool to verify your app prior to deployment (if >> you know such tools please tell me!) I don't see much difference here, >> mostly syntax sugar and enforcing right style (which is not bad - just >> it's not that big a deal). > Most of the current applications of PHP do not need strict type checking, and > PHP as we know today perfectly fits these needs. But debugging and "cleaning" > large applications may become a nightmare. > That's why I developed PHPLint, I think this is a very nice tool and the way to go in PHP. You should showcase demo it on one of the conferences! And provide links here of course :-) marcus > a PHP parser and validator that performs > a static analysis of the source, ensuring the safe handling of types. In > a word, this tool makes PHP very close to a strong-typed language without > the need to further complicate the interpreter with new features that would > pervert the nature of the language. > Every constant, variable, property has a well defined type, and every > function and method has a well defined signature that can be guessed by > PHPLint or provided through specific meta-code as in this example: > $i = 123; > # type of the variable guessed as int > define("RND_K", 1.0 / (1.0 + getrandmax())); > # type of the constant guessed as double > function rnd() > { > return RND_K * rand(); > } > # signature guessed as float() > $i = rnd(); > # ERROR: assigning double to int > function textToattribute(/*.string.*/ $a) > { > return "\"" . htmlspecialchars($a) . "\""; > } > # signature string(string) > Best regards, > ___ > /_|_\ Umberto Salsi > \/_\/ www.icosaedro.it Best regards, Marcus