On 13 October 2015 at 11:59, Andrea Faulds <a...@ajf.me> wrote:

> 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".


I said "almost" for a reason. More clearly, we use the long names in prose
and by convention the short ones in the function prototypes.


>
>
> 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.


I would say that more confusion will arise from trying to use something
that comes naturally (e.g. "integer") and getting an error, than having it
"just work".


>
>
> 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.
>

So what if there is more than one way to say "hey, I want an integer here",
particularly when they're super-duper common terms that are used
everywhere. (I'm talking about "boolean" and "integer" specifically,
however if someone wants to use "long", or "double", or "real" then why the
hell stop them?


>
> 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.
>

-1 to throwing an error, that's just completely the wrong direction in my
view. I'd much rather your example 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