3 ms·
I believe it is possible to implement effective and fundamentally sound functional programming without types. Types just make it easier to avoid mistakes in fun
by daveguy 4y ago
I believe it is possible to implement effective and fundamentally sound functional programming without types. Types just make it easier to avoid mistakes in functional programming. Like object oriented paradigms can be implemented in procedural languages like C, but they are easier in languages with built-in object oriented tools.
First class functions are definitely a must.
- DonaldPShimoda 4y ago> I believe it is possible to implement effective and fundamentally sound functional programming without types. I prefer working in statically typed languages, but I agree with you (though only if we use a colloquial definition of "sound"). And, what's more, I think the correspondent in the article would agree also. Michael Sperber is very familiar with Scheme, as evidenced by his publication history. I think your point actually connects with a line from the article: > Components in functional programming are essentially just data types and functions, and these functions work without mutable state, [Sperber] said. Even in a dynamically typed language, the data still "has a type" — but now we're talking about the "shape of the data" rather than a formal type system. Reasoning about data-shapes is perfectly valid, and still supports the style of code that Sperber talks about throughout the interview. This also connects to the "Design Recipe" from the textbook How to Design Programs, which is an introductory CS text based on Racket, a derivative of Scheme. In the Design Recipe, students are told that they should write down the contract of their function before implementing the body of the function, and part of this is the specification of the "types" of the inputs and the output. Again, since the language is untyped, this has much more to do with conveying a sense of the "shape" of the data to the programmer, but it is still highly effective in guiding the design and implementation of a functioning software system.
- marcosdumay 4y ago> Types just make it easier to avoid mistakes If you look at a language like Haskell, types are there to provide polymorphism and allow you to rearrange the language in convenient ways. It's impossible to say what is the single main use of types there, but this is certainly one of the most important ones. Another main use of types there is documenting interfaces. People only get to say that types provide nothing else but correction if they decide that all the other uses are non-important and should be ignored. But then, that's a pretty trivial and useless information.
- Freire_Herval 4y ago[dead]
- chrischen 4y agoAll programs have types because a sound functional program has well known inputs and outputs. A type system just enforces and encodes it to some degree, and if the compiler knows the types as well then further abstractions can be built on that.