Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58722 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47667 invoked from network); 7 Mar 2012 08:22:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2012 08:22:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=christian.kaps@mohiva.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=christian.kaps@mohiva.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mohiva.com from 80.67.31.98 cause and error) X-PHP-List-Original-Sender: christian.kaps@mohiva.com X-Host-Fingerprint: 80.67.31.98 smtprelay05.ispgateway.de Linux 2.6 Received: from [80.67.31.98] ([80.67.31.98:49295] helo=smtprelay05.ispgateway.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/A1-38795-0CA175F4 for ; Wed, 07 Mar 2012 03:22:25 -0500 Received: from [80.67.16.114] (helo=webmail.df.eu) by smtprelay05.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1S5C8b-0002b0-Dm for internals@lists.php.net; Wed, 07 Mar 2012 09:22:21 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 07 Mar 2012 09:22:21 +0100 To: In-Reply-To: <4F570EBB.6030103@sugarcrm.com> References: <52.38.15021.3A1E65F4@pb1.pair.com> <4F570EBB.6030103@sugarcrm.com> Message-ID: <60744d7ea642fe03c7110502a3f4276a@mohiva.com> X-Sender: christian.kaps@mohiva.com User-Agent: Roundcube Webmail/0.6 X-Df-Sender: Y2hyaXN0aWFuLmthcHNAbW9oaXZhLmNvbQ== Subject: Re: [PHP-DEV] Scalar Type Hinting From: christian.kaps@mohiva.com (Christian Kaps) Hi, I'm with Stas here. First let me say that I would like to see type hinting for scalars in PHP. As a userland developer it would help me to write clean and more robust code. But I think this proposal is only a workaround to get a round the main problem. It's a try to push similar functionality into PHP without breaking BC. I think it's the wrong way. Anthony, You addressed one of the main issues in your last post. >> Again, I personally see casting data-loss a bigger issue than just >> parameter hinting, which should get its own RFC to clean up. That's >> why I didn't include it here. On purpose... Why not try to change this first? I know there are more issues to solve. But I think only solving issue piece by piece, regardless if BC breaks, brings a robust and clean implementation of this feature. Not immediately, maybe in the next major version. Just my 2 cents. Christian Am 07.03.2012 08:31, schrieb Stas Malyshev: > Hi! > >>>> https://wiki.php.net/rfc/parameter_type_casting_hints > > Just took a look on it - the syntax proposed there is quite ugly and > rather confusing, I really wouldn't like to have such syntax in PHP. > Also "(int) $foo = “1” will generate an E_COMPILE_ERROR" makes no > sense to me. > Also, this line: > function test((int) $intParam, (string) $strParam = "foo", (array) > $array) {} > > is not proper PHP code - it contains optional parameter and then > parameter with no default. > > And can we please stop using word "hinting"? > We can call it type conversion, typecasting, type coercion, etc. > http://en.wikipedia.org/wiki/Type_conversion > > But I don't see how there's any hinting involved. > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227