Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80056 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48440 invoked from network); 1 Jan 2015 16:36:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jan 2015 16:36:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.181 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 74.125.82.181 mail-we0-f181.google.com Received: from [74.125.82.181] ([74.125.82.181:49238] helo=mail-we0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/3E-60454-C8775A45 for ; Thu, 01 Jan 2015 11:36:29 -0500 Received: by mail-we0-f181.google.com with SMTP id q58so3593717wes.40 for ; Thu, 01 Jan 2015 08:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pwAlic67Yh0/PPzXDzj7fwh2hLz8WkeQ8Z/RxUeJgPk=; b=h9BdaPK24i/i+JYHznogj/Orn7WdAQeWAJZS/QJqtDwY48UjFF4xN77p8WJ0AzzXHg louV0VD/aSJ8JqySgiGpeCwCQSeEwRRS/EU/+mCkJgrLFGZ9i3xsRHIZH600AZaXTgMv YsONy+2ueQQOmGeAPXDlg6yrDnCqsT6V/VRbrj+fVaulvYAmCFAx2T9hq0nHRqLUQz+T 0pNeIAVNbMt5P1qP9edH1XeS7qi5nJZ+iyBiRkleYabxzlQulYnZElq+Q7KLV54+/Y2b sTM+O76+H+XYuaMr+QS1xhy7vO7XHD7CP3Zhe92rLu/lWhsDjMDQii6jUzlVVIKQBJMI dTDg== MIME-Version: 1.0 X-Received: by 10.194.90.10 with SMTP id bs10mr143207195wjb.43.1420130184053; Thu, 01 Jan 2015 08:36:24 -0800 (PST) Received: by 10.180.88.33 with HTTP; Thu, 1 Jan 2015 08:36:23 -0800 (PST) In-Reply-To: References: <41D5BB0B-73AF-488E-968D-90B2878E3178@ajf.me> Date: Thu, 1 Jan 2015 17:36:23 +0100 Message-ID: To: marcio3w@gmail.com Cc: Andrea Faulds , Nikita Popov , PHP Internals Content-Type: multipart/alternative; boundary=047d7bd9058e27cce2050b99d384 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints From: tyra3l@gmail.com (Ferenc Kovacs) --047d7bd9058e27cce2050b99d384 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Jan 1, 2015 at 4:59 PM, Marcio Almada wrote= : > The battle between strict type declarations vs coercive has been here for= a > while. My problem with coercion in detriment of strictness is > that sometimes you DON'T WANT TYPE CASTING AT ALL. This new feature would > 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 bo= th > 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 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 --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --047d7bd9058e27cce2050b99d384--