2014-11-04 9:51 GMT-08:00 Stas Malyshev <smalys...@sugarcrm.com>:

> 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.
>
> Haskell does:

length :: [a] -> Int
length [] = 0
length (_:xs) = 1 + length xs


> > 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/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to