The trouble is, I would love to have a language with properly controlled side effects and the basic functional goodies, but for real world use I'm not aware of any functional language that doesn't also make something basic much harder than imperative languages do.
If I could have a language with the functional toys of an ML or a Haskell, but where the impure side of things was as easy to write as the pure computations, that would be great. But for that to happen, I suspect there needs to be a dramatic shift in the way effectful code is written, in the same way that type inference practically eliminated all the syntactic overheads we might otherwise have assumed were necessary with a static type system.
I've seen a lot of research in this area, and there's huge potential in some of the ideas being tried out in languages like Haskell, but to my knowledge no-one has really hit anywhere near the sweet spot I'm looking for in a production language yet.
[...] where the impure side of things was as easy to write as the pure
computations, that would be great.
From your post, I'm going to assume that you haven't used the languages
I'm talking about; sorry if I misread that. SML/Ocaml/F# are not purely
functional languages, so side effects work just like you'd expect coming from C/Python/etc. The language
encourages functional programming (for example, variables are immutable by default),
but imperative code is far from difficult to write. I highly recommend
you try one of these languages. They may just be what your looking for.
I have some experience with both SML and OCaml, though it is quite limited.
Perhaps it's either my background writing a lot of fairly mathematical code or simply my own ignorance, but I always found little things like having to distinguish * and *. operators in OCaml rather awkward. Granted, it beats M.times(a).plus(b), but it's the sort of slightly clunky blemish that puts me off, and it betrays a certain lack of power in the underlying model. (Haskell almost has the opposite problem, with a type system that seems able to do almost anything, but also having all the complexity that inherently comes with that.)
If I could have a language with the functional toys of an ML or a Haskell, but where the impure side of things was as easy to write as the pure computations, that would be great. But for that to happen, I suspect there needs to be a dramatic shift in the way effectful code is written, in the same way that type inference practically eliminated all the syntactic overheads we might otherwise have assumed were necessary with a static type system.
I've seen a lot of research in this area, and there's huge potential in some of the ideas being tried out in languages like Haskell, but to my knowledge no-one has really hit anywhere near the sweet spot I'm looking for in a production language yet.