Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9270 invoked by uid 1010); 3 Jan 2008 21:04:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9254 invoked from network); 3 Jan 2008 21:04:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2008 21:04:51 -0000 Authentication-Results: pb1.pair.com header.from=tomi@cumulo.fi; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=tomi@cumulo.fi; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cumulo.fi from 81.228.11.120 cause and error) X-PHP-List-Original-Sender: tomi@cumulo.fi X-Host-Fingerprint: 81.228.11.120 pne-smtpout3-sn1.fre.skanova.net Solaris 10 (beta) Received: from [81.228.11.120] ([81.228.11.120:38852] helo=pne-smtpout3-sn1.fre.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/67-20810-0FD4D774 for ; Thu, 03 Jan 2008 16:04:48 -0500 Received: from [192.168.1.3] (84.250.46.16) by pne-smtpout3-sn1.fre.skanova.net (7.3.129) (authenticated as kaisto-9) id 474FCCB000193260 for internals@lists.php.net; Thu, 3 Jan 2008 22:03:51 +0100 Organization: Cumulo Studio To: internals@lists.php.net Date: Thu, 3 Jan 2008 23:02:12 +0200 User-Agent: KMail/1.9.7 References: <200801031903.01980.tomi@cumulo.fi> <1199392531.15292.64.camel@sbarrow-desktop> <477D4ACF.3030006@zend.com> In-Reply-To: <477D4ACF.3030006@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200801032302.12770.tomi@cumulo.fi> Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: tomi@cumulo.fi (Tomi Kaistila) On Thursday 03 January 2008 22:51:27 Stanislav Malyshev wrote: > > In a way this is true, but I look at it this way. Some languages are > > strictly typed, some are dynamically typed. PHP can have the best of > > both worlds by having optional strict typing where desired, as well as > > I do not believe trying to both eat cake and leave it intact would do us > well. Mixing strict and non-strict code would be a nightmare. Absence of > static type control (necessary for interpreted language) would make > strictly typed code less, and not more stable. Add performance penalty > from type checking and effort would be required from PHP newcomers to > understand two code models instead of one - and you get the worst of > both worlds, not the best. I am not convinced that using type hinting would issue a big performance drawback because of type checking, for the reason that it is already happening. We can already hint types for arrays and objects. And whenever I build function that accepts a scalar value, 90% of the time I have to write a check to make sure the value is acceptable for the operation that occurs inside the function. So no matter what, type checking occurs. And so far I have been able to write lightweight programs when it has suited me, with or without type checking. It is especially in such cases where it would be helpful to skip the test myself, when I know that only the type of variables that I specify can be passed in. It is less and easier coding for me. Also, as this has been mentioned several times already, using type hinting is completely voluntary. Hence, newcomers do not need to bother with it until they are ready to try it out. If it is required in a job, then it hardly matters because it is probably one of the simplest things they might demand from a PHP developer. > That's not what I am hearing here on the list. I did not get this comment. Tomi Kaistila PHP Developer