>
>
>
> The RFC doesn't explain it either beyond "here how you can have some nice
> errors".
> But why would I want to see these errors? How they would make anything
> easier or better?
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>

maybe we should improve on the rfc.
I see many advantages of the introduction of return type hinting.
- you can guarantee that your methods returns only what is explicitly stated
(or else it blows up, the same as for arguments)
- it can save you from having to define the return type in phpdoc, your code
can define it's behavior
- I think maybe the language itself could use that information, for
performance, etc. improvements (we know that the return value will be
created runtime, but we can throw it away if it doesn't match the return
type or something), maybe we can use that information to throw errors on
compile time if we find a non runtime decided return value which doesn't
match with the return type.

I'm sure that others have and will come up with more use cases.

Tyrael

Reply via email to