Re: Q on Primitives
| From: | Robin Burchell | Date: | Fri, 19 Dec 2008 13:38:36 +0000 |
| Subject: | Re: Q on Primitives | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42345@lists.php.net to get a copy of this message | ||
Just a random thought I have from reading over that:
Would it not be more 'natural' to change 'function' to indicate a
method with a variant return type, and allow e.g.
'int somefunc()' instead of 'function (int) somefunc()' to indicate an
int return?
It would be a bit more in fitting with traditional languages, and
definitely less typing.. it may require some parser modification,
though..?
(I'd also like to throw my +1 in for scalar type hints, and optional
type coercion for return values - this is something I have run into
annoyances with and blogged about in the past)
Thanks,
Robin Burchell
On Fri, Dec 19, 2008 at 2:23 AM, Kalle Sommer Nielsen <kalle@php.net> wrote:
> 2008/12/18 Nathan Rixham <nrixham@gmail.com>:
>> Nathan Rixham wrote:
>>
>> and strongly typed returns.. nearly forgot
>>
>> public static function parseByte( Number $var ):bool {
>> or
>> public static function bool parseByte( Number $var ) {
>>
>> or such like
>>
>
> Theres already an RFC for this:
> http://wiki.php.net/rfc/typehint
>
>
>
>
> --
> Kalle Sommer Nielsen
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>