Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80068 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69884 invoked from network); 1 Jan 2015 18:17:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jan 2015 18:17:26 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.178 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.217.178 mail-lb0-f178.google.com Received: from [209.85.217.178] ([209.85.217.178:55527] helo=mail-lb0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/62-60454-33F85A45 for ; Thu, 01 Jan 2015 13:17:24 -0500 Received: by mail-lb0-f178.google.com with SMTP id f15so16439757lbj.9 for ; Thu, 01 Jan 2015 10:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Ec0ZnUBmkphzXlYetUNimOnKdhG7wu6cTzHIWV7tMvo=; b=Ih+X/cwOIJLmHOM4nyYXiIUpy/Op5RBWMl/0qbWkDPjAw+GsbbeSGtkGHtt+qG/nKB hk8lT/87TN0aw507wZ1KJOJQcs5qVVqhqlhqrW5ypWqA98rPk5lVTmCz5nu1fzVDK53b DSlRn7PazJ62JCS5/IMe9XAZapSyqtDbaOdQ25j9zSvkFBQbAEnsHOI3jDd65bhOZZrf loWX0W2uMcH7vz+fStPM3MoEd31HDe1kTqdZfNToE+mVr/UKH6HmrcovjtSGEwuKXRl4 Ha79pbDezdOjuDpXw1PUZoz3PH4sYPMQGvDLvwa3wtvxMYjXi1hUuuJWWf8ZCyGrl2kY 3B6A== X-Received: by 10.112.27.133 with SMTP id t5mr72543234lbg.45.1420136240104; Thu, 01 Jan 2015 10:17:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.21.101 with HTTP; Thu, 1 Jan 2015 10:16:59 -0800 (PST) Reply-To: marcio3w@gmail.com In-Reply-To: References: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> Date: Thu, 1 Jan 2015 15:16:59 -0300 Message-ID: To: Ferenc Kovacs Cc: Andrea Faulds , Nikita Popov , PHP Internals Content-Type: multipart/alternative; boundary=001a1133b04a1fcd8b050b9b3cf4 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints From: marcio.web2@gmail.com (Marcio Almada) --001a1133b04a1fcd8b050b9b3cf4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > for the record this was proposed (as an idea) previously with the exact same syntax(the earlies mention I could find in my mailbox was > from Derick from 2009: http://comments.gmane.org/gmane.comp.php.devel/57653 but I remember seeing it every time when this > discussion happens). > If somebody is interested in previous attempts/discussion on the topic, here are some links for starters: > http://nikic.github.io/2012/03/06/Scalar-type-hinting-is-harder-than-you-th= ink.html, http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html, https://wiki.php.net/rfc/parameter_type_casting_hints, https://wiki.php.net/rfc/typechecking Ferenc Kovacs, thanks for referencing it up! I wasn't aware this proposal was so recurrent. Anyway, this seems to be the most interesting solution we could have now without compromise against the long awaited strict type check in the future. One big plus is that "parameter type casting" wouldn't offer any bc break and therefore is much easier to pass. Backed up by all the references Ferenc Kovacs listed, I'd like to suggest Andrea Faulds to use parameter type casting syntax for this RFC. Regards M=C3=A1rcio Almada https://github.com/marcioAlmada 2015-01-01 13:36 GMT-03:00 Ferenc Kovacs : > > > On Thu, Jan 1, 2015 at 4:59 PM, Marcio Almada > wrote: > >> The battle between strict type declarations vs coercive has been here fo= r >> a >> while. My problem with coercion in detriment of strictness is >> that sometimes you DON'T WANT TYPE CASTING AT ALL. This new feature woul= d >> create serious impediments. So I wonder if we couldn't have both (strict >> and coercive types declarations) and leave the current proposed type >> hinting syntax reserved for strict type declarations? Like in: >> >> function(int $a, (int) $b) { >> // $a will be strict >> // $b will be type casted >> } >> >> This way we can actually choose when to cast and when to be strict and >> both >> features could be voted independently without affect each other possible >> future adoptions. >> > > for the record this was proposed (as an idea) previously with the exact > same syntax(the earlies mention I could find in my mailbox was from Deric= k > from 2009: http://comments.gmane.org/gmane.comp.php.devel/57653 but I > remember seeing it every time when this discussion happens). > If somebody is interested in previous attempts/discussion on the topic, > here are some links for starters: > > http://nikic.github.io/2012/03/06/Scalar-type-hinting-is-harder-than-you-= think.html > http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html > https://wiki.php.net/rfc/parameter_type_casting_hints > https://wiki.php.net/rfc/typechecking > > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu > --001a1133b04a1fcd8b050b9b3cf4--