Re:Things you should know about PHP 7
by Spoom on Thursday March 26, 2015 @10:24AM
(#9269802)
I thought that was rather odd as well. Are there many languages using this form of return type specifier?
[ Parent
| on HN ]
It's fairly common in languages that determine (return) types themselves, e.g. Haskell, Scala and F# all use this syntax. Most languages that use a C-style syntax put (return) types in front.
It makes very little sense for PHP. A function definition now even has both styles:
`function foo(argtype arg) : rettype` instead of `function rettype foo(argtype arg)` or `function foo(arg : argtype) : rettype`.
Re:Things you should know about PHP 7
by TazeTSchnitzel on Thursday March 26, 2015 @10:45AM
(#9269945)
Hack, ActionScript and TypeScript put the type after. Hack is most likely where this syntax came from.