Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88785 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48314 invoked from network); 13 Oct 2015 22:49:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2015 22:49:38 -0000 X-Host-Fingerprint: 2.123.167.169 unknown Received: from [2.123.167.169] ([2.123.167.169:23775] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/80-41961-18A8D165 for ; Tue, 13 Oct 2015 18:49:37 -0400 Message-ID: To: internals@lists.php.net References: <5C.21.16518.AA80C165@pb1.pair.com> Date: Tue, 13 Oct 2015 23:49:27 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 2.123.167.169 Subject: Re: [PHP-DEV] Scalar type hints and scalar type name aliases cause confuson From: ajf@ajf.me (Andrea Faulds) Hi Adam, Adam Harvey wrote: > (Sorry Andrea, I'm picking on your e-mail because it's easiest, but > it's a general response to the thread.) Ah, don't worry about it. > I agree that we should do something, but I think we should alias. > > We allow both "int" and "integer" in settype() and we allow it in type > casting — the two other places where a user can specify a type for > conversion. We also support 'real' and 'binary' in casts, but these are quite rare, and I think (int) is a lot more common than (integer), heck, the manual uses it. > I still think it's a poor choice to not allow both in type > declarations: while I'm generally a fan of having one way to do > things, I believe that the inconsistency in the language is worse than > the potential ambiguity in style guides. Well, we could support the full set of names (int, integer, long, float, double, real, string, binary, bool, boolean) everywhere, but this is a bit unruly. It's better to pick one and stick to it, and discourage the us of the others or slowly phase them out. > > Hell, _I_ still can't remember which out of "int" and "integer" is the > right one, and I've now written a decent amount of PHP 7 code _and_ > wrote half of the documentation for this. The rule seems to be 'integer' in English, 'int' in code, for the most part. > Plus, if we error when "integer" is used, we've moved people's cheese > anyway (by disallowing the class name). Let's not compound that by > forcing them to do busywork. I think this would drill into you that it's 'int' not 'integer' pretty quickly, so it wouldn't become annoying. > > Adam, who hopes that anecdote doesn't say more about his working > memory than the design of the language. > PHP is a confusing behemoth, don't worry, you're not alone :) Thanks. -- Andrea Faulds http://ajf.me/