3 ms·
The only popular language I can think of that requires side effects to be declared is Haskell. Which doesn't have a distinction between statements and expressio
by colonwqbang 3y ago
The only popular language I can think of that requires side effects to be declared is Haskell. Which doesn't have a distinction between statements and expressions.
Are there any good examples of languages that have it, where it isn't "useless"?
- epgui 3y agopython, javascript, pretty much any language that is popular. I believe everything in Haskell is an expression, even the do notation, no? But I think the argument being advanced is that the distinction between statements and expressions is fundamentally unnecessary. I don’t really know of any good argument in favour of them: I tend to think lisps have the perfect and simplest possible syntax.
- gumby 3y agoYes, that is indeed the point I was making. And yes, I’m a lisp programmer.
- colonwqbang 3y agoPython, Lisp and Javascript don't require functions with side effects to be declared in a particular way. Haskell does.
- epgui 3y agoThe question was about expressions vs statements, not about the IO type.
- colonwqbang 3y agoI was replying to the point programmer_dude made in his comment.