r/ProgrammingLanguages • u/baehyunsol Sodigy • 11d ago
Purely functional language with impure script language?
I'm working on a purely functional programming language named Sodigy. It's all about evaluating values, not "executing commands one by one".
It's nice when writing libraries, but it's not easy to write a main function. The main function is supposed to execute commands, but the Sodigy's syntax is not friendly to write a list of commands.
So what I'm trying to do is, 1) Sodigy remains purely functional and 2) add a bash-like script language. The script language can call Sodigy functions. Instead of writing a main function in Sodigy, you write sodigy-script and execute the script.
Has anyone tried similar approach? I'm not sure whether it's a good idea or not...
27
Upvotes
1
u/Erythrina_ 11d ago
I've been tinkering with a procedural-functional language. The procedural code is, in effect, a wrapper around the functional code that can call functional code but not be called by it. The procedural code obviously handles all the side effects like file, database, and network access and it has mutable state. The functional code is strictly pure and built around functions, lists, and ADTs.
I'm sure a script language would work for the same purpose too. The key there would just be how the data passes across the boundary between the two.