Re: Types on the right or on the left
| From: | Stas Malyshev | Date: | Wed, 05 Nov 2014 04:49:12 +0000 |
| Subject: | Re: Types on the right or on the left | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78703@lists.php.net to get a copy of this message | ||
Hi!
> C++11 adds suffixed types for returns despite having prefixed types
> for everything else, including previous return types.
C++ does it for entirely different reasons, related to scoping, and it
still has "auto" type at the beginning. In any case, I'd be very vary
taking late C++ hacks as a guide for syntax, as advanced C++ syntax is
not something I would recommend as an example of clarity.
> 3) Claiming compatibility for things which aren't proposed is meaningless.
>
> People have already asked for support for static return types; doing
People asked for a lot of things, it doesn't mean it makes sense.
"static" as return type doesn't, since it does not specify any type at
all - it just says "I will return a type that is this class or derived
from this class" - which is the same as saying 'self'. There's no
additional information one can gather from 'static' declaration which is
not in 'self' declaration, and I see no use case to ever use it.
>
<return_type> "function" <identifier> "(
> <parameter_list> ") would
> then be ambiguous. This is not some pie-in-the sky issue.
It's not, it's a non-issue at all, since "static" does not make sense in
that context.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/