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/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to