Hacker News new | ask | show | jobs
by xvinci 537 days ago
> One of Haskell’s most basic innovations (well, I’d guess it probably wasn’t first, but compared to other relatively mainstream languages) was the ability to write the type of a function separately from writing the function body.

Anyone familiar with the initial versions of C / C++? Both languages have offerd the ability to define your function signatures in header files for as long as I have known them, so if you wished to separate from the actual function body you should have been able to do that.

But then Haskell can hardly have been the first mainstream? But maybe someone with more ancient knowledge could share some insights - thx.

3 comments

I wouldn't characterize a forward declaration of a function as a distinct definition of its types—any types in the forward declaration must match those in the implementation; there's no way to implicitly refer to the types used in the forward declaration to ensure a single place of typing.
Arguably COBOL has it with its data division, as does Ada.
Common Lisp supports something along those lines, mostly for optimization purposes.