Hi Peter,

Peter Cowburn wrote:
I would much rather we use the full names for these types across the board.

I would mostly agree with you. Using the full English names whenever we're writing English, not code, makes sense. But we usually use int/float/etc. in code, like other languages do, and I don't see a good reason to change that.

The manual uses them almost exclusively,

Not for type signatures it doesn't. It usually uses "int" and "bool".

and I'd hazard a bet that it is
many peoples' first choice when trying out the argument/return type
declarations.

Yeah, and others will sometimes use them by 'mistake'. I know I certainly have. So we need to prevent this creating confusion.

Failing that, at least making them available as aliases is a good thing in
my book.  I never understood the reluctance to make use of all existing
names when the type declarations discussions were going on. Fact is, people
are going to type "double", "long", etc. in their declarations... why get
in their way?

I don't want to allow them as aliases, because it means another thing to add to style guides. Some people would use 'float', some 'double', some would use 'int', some 'integer', some 'long'. It'd be much cleaner to just pick one and stick with it. Types don't need multiple names.

However, as you mention, many people are used to the other variants. So I'd like to reserve them and throw an error if you use them. Much better than people typing 'function format_number(double $number, long $digits)` and getting bewildered when it doesn't work.

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