Hmm. How would it break it?

By leaving 'function' to mean variant, it's only adding new
functionality by overriding types to replace 'function', which should
have no issue with older code, surely?

To clarify:

current method declaration:
function foo()
public static function foo()
public function foo()

.. and so on

new method declaration could stay the same, if the author didn't care
about return type, or:
int foo()
public int foo()

.. etc.

The only possible issue I can see is where e.g. there is a class named
'static', which, IIRC is already impossible.

If I'm missing something, please let me know :)

On Fri, Dec 19, 2008 at 2:31 PM, Nathan Rixham <nrix...@gmail.com> wrote:
> Robin Burchell wrote:
>>
>> 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 break all php code existing so far; the only real way to implement
> return value types would be as such
>
> public static function somefunc():int {
>
> this would allow the return type to be optional and leave all existing code
> functional; likewise it could be implemented for any style of php'ing, thus:
>
> #php4 style class method or normal procedural function
> function dosumit():int {
>
> type hints are all ready there so adding primitives /should/ be possible
> without any bc issues
>
>

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

Reply via email to