Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81073 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45664 invoked from network); 24 Jan 2015 11:09:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jan 2015 11:09:12 -0000 Authentication-Results: pb1.pair.com header.from=php@tutteli.ch; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@tutteli.ch; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: php@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:32795] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/30-42985-75D73C45 for ; Sat, 24 Jan 2015 06:09:12 -0500 Received: (qmail 21187 invoked from network); 24 Jan 2015 12:09:08 +0100 Received: from cm56-153-252.liwest.at (HELO RoLaptop) (86.56.153.252) by ns73.kreativmedia.ch with ESMTPSA (AES256-SHA encrypted, authenticated); 24 Jan 2015 12:09:08 +0100 To: "'PHP Internals'" References: <002601cff777$eb923430$c2b69c90$@tutteli.ch> <000601cff80a$972e0250$c58a06f0$@tutteli.ch> <5458937F.9020304@sugarcrm.com> <545910F1.8030904@sugarcrm.com> <859A97F0-7C58-406A-857B-557F8AA657AD@ajf.me> <545917A2.6000206@lerdorf.com> <545977E1.2060700@sugarcrm.com> <54599A0F.2060400@sugarcrm.com> In-Reply-To: Date: Sat, 24 Jan 2015 12:09:04 +0100 Message-ID: <001801d037c6$2a7976c0$7f6c6440$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHFXQsvCqySdhOS5hZldA9wwvCKZAF9M3/mAYp5CtcBNMNzSAHPQl4cAlVpj94BMv5G9QMxLPs8AiFJj1EBgz6DMQIX/5PbAo9K9TYCJ9Sm15uwPIvQ Content-Language: de-ch Subject: AW: [PHP-DEV] Types on the right or on the left From: php@tutteli.ch ("Robert Stoll") I would like to pick up this discussion again - now that the return type = hint RFC has passed, congratulations :) As a quick reminder, this discussion should not be whether we want to = put the return types on the left or on the right but mainly if we want = to have consistency (I do not want to downgrade the return type hint RFC = either, that is the reason why I have waited till the vote was closed). = Once agreed upon that consistency should be key when it comes down to = the place of type hints, we can then discuss what approach PHP shall = take in the future (all left or all right). =20 The more I think about it the more I am in favour of putting types on = the right hand side. I think it is more readable and less ambiguous. = Consider the following: class A{ private Foo $a; //is "Foo" a modifier as well? private static $b; //or is "static" a type? } vs. class A{ private $a : Foo; private static $b; } Assuming we will introduce parameter modifiers such as final or similar = in the future, then it is also less ambiguous for parameter type hints: function foo(final A $a, final $b){} vs function foo(final $a : A, final $b){} I am sure people will tell me that such a change (all types on the = right, parameter type hints as well) is huge BC and unfeasible. I would = agree that it is a huge BC but I would claim it is necessary and = manageable. Code could be migrated automatically with an appropriate = tool and it does not need to happen for PHP 7 but maybe for PHP 8. = Besides, pretty much the same impact has the return type RFC now, = because the manual should be updated accordingly to reflect the new = syntax IMO. Sounds like lot of work but it should be possible to migrate = the docs with a tool. And it needs to be done IMO otherwise the = WTF/minute measurement will increase when using PHP (due to lot of "WTF! = In the docs the return types are on the left and in code they are on the = right hand side") - but maybe I am wrong. Anyway, I am primarily in favour of consistency - regardless if all left = or all right - and mixing both styles is a very bad idea IMO - do you = know any language which has taken a mixed approach (besides Hack)? =20 Cheers, Robert