Re: AW: [PHP-DEV] Types on the right or on the left
| From: | Stas Malyshev | Date: | Tue, 04 Nov 2014 17:51:45 +0000 |
| Subject: | Re: AW: [PHP-DEV] Types on the right or on the left | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78654@lists.php.net to get a copy of this message | ||
Hi!
> I thought it was inconsistent, but after discussions on
> StackOverflow, I don't think it actually is.
If you specify the type once as "Foo something" and once as "something:
Foo" then I don't see how there's even a place for discussions that it's
inconsistent.
> Return types describe the return type of a function, not the type of
> a function.
Given that in PHP functions do not have types, not being objects of the
language, this seems to be argument invented just to ignore the
inconsistency.
Moreover, in languages where functions do have types - e.g. ML for
example - the return of the function is specified in exactly the same
manner as parameter type, and type of the function itself is never
specified explicitly, but if needed, it is referred to with different
syntax (->). See: https://en.wikipedia.org/wiki/Standard_ML
Same situation with ActionScript: https://en.wikipedia.org/wiki/ActionScript
both parameters and return type use ":" and nobody thinks that specifies
type of the function - as, again, nobody ever specifies type of the
function as such. In fact, I can remember no language that would specify
type of the function (as opposed to parameters + returns) when declaring
a function, even among languages with first class functions.
> Also, it's worth bearing in mind that
public Foo function
> was
> rejected previously.
Many things were rejected previously, but the RFC does not bring any
argument about it and never even mentions it as far as I can see.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/