6 ms·
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 synt
by dtech 12y ago
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`.
- TazeTSchnitzel 12y agoHack, ActionScript and TypeScript put the type after. Hack is most likely where this syntax came from.