3 ms·
I thought that was rather odd as well. Are there many languages using this form of return type specifier?
by Spoom 12y ago
I thought that was rather odd as well. Are there many languages using this form of return type specifier?
- dtech 12y agoIt'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.