Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81109 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46559 invoked from network); 25 Jan 2015 06:48:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jan 2015 06:48:35 -0000 Authentication-Results: pb1.pair.com header.from=francois@tekwire.net; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=francois@tekwire.net; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain tekwire.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@tekwire.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:37567] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/F0-36889-1C194C45 for ; Sun, 25 Jan 2015 01:48:34 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 995124B00A5; Sun, 25 Jan 2015 07:45:44 +0100 (CET) Reply-To: To: "'Yasuo Ohgaki'" , "'Andrea Faulds'" Cc: "'Robert Stoll'" , "'PHP Internals'" References: <002601cff777$eb923430$c2b69c90$@tutteli.ch> <68518A5F-4A11-4D93-914D-760A4CB447E8@ajf.me> In-Reply-To: Date: Sun, 25 Jan 2015 07:48:28 +0100 Message-ID: <004301d0386a$ed922090$c8b661b0$@tekwire.net> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHFXQsvCqySdhOS5hZldA9wwvCKZAI0n7LwAw51D/ucu/qMcA== Content-Language: fr X-Antivirus: avast! (VPS 150124-1, 24/01/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Types on the right or on the left From: francois@tekwire.net (=?UTF-8?Q?Fran=C3=A7ois_Laupretre?=) > De : yohgaki@gmail.com [mailto:yohgaki@gmail.com] De la part de Yasuo = Ohgaki > > > Mixing both, having some types on the left and others on the = right, > > seems like another inconsistency in the language > > > design to me. > > > > These inconsistencies exist for two reasons: > > > > - Opposition to doing it the other way > > - Hack already doing it this way > > > > I don=E2=80=99t think `function void foo();` will happen, since = that=E2=80=99s been > > previously rejected as it breaks gripping for =E2=80=9Cfunction = foo=E2=80=9D. Similarly, I > > don=E2=80=99t think `public $foo: Foo;` will happen, given Hack does = it as `public > > Foo $foo;`. >=20 > I agree with Andrea. >=20 > There are people who dislike syntax, and/or thinks PHP missing = check(i.e. > array format, etc). These people should request DbC. > DbC is more powerful than simple type checks and have no performance > penalty in production. (I'm not saying type hinting is > useless. I'll use it where it is appropriate, too.) +1. I have been reading these discussions about type hinting for years. = Every time, people try to bring strong typing through various artefacts, = because they don't understand the benefits of loose typing. Some years = ago, their model was java, today, it is a combination of java and Hack. Unfortunately, the RFC on return types was approved. It was just a = question of time, with all these people pushing during years. = Half-backed, short-term solution, attractive at first sight but bringing = more problems than it solves... It will probably have catastrophic = implications on the 'REAL' solutions someone may propose in the future. From the beginning, I think that DbC based on phpdoc annotations, with = controlled type conversion (which ones are valid, which ones are not) = and switched on/off by an INI parameter would be the best solution to = provide the restrictions and checks developers are asking for. = Unfortunately, half-backed, short-term solutions, like return types and = type hinting, will make proposing such a solution harder, as we will = need to keep BC. It will even be an argument to fight against a better = solution. Cheers Fran=C3=A7ois