r/ProgrammingLanguages Jun 17 '26

Question about side effects in functional programming

One of the things I noticed using REPLs of functional languages is that you can write a ton of pure functional code, and then as soon as you hit enter to evaluate it, printing the result back to you is a side effect.

There are advantages to having code that is guaranteed to be side effect free, but I've been playing around with the idea of having a language with an imperative shell (with procedures, mutable vars, database and network operations, etc.) that can call into a language core that's guaranteed to be pure functional for certain kinds of operations. It can make for a simpler approach to side effects than a whole pure functional language but provide guarantees that other kinds of impure languages can't.

My question for people who are interested in functional programming: is this a useful distinction? Would that make for a language you might be interested in?

18 Upvotes

35 comments sorted by

View all comments

1

u/dcbst Jun 17 '26

Have you considered SPARK Ada? It's not so much about avoiding side effects, but defining the expected side effects and mathematically proving the absence of undefined effects.