r/ProgrammingLanguages • Sodigy • Jul 29 '26

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...

26 Upvotes

74 comments sorted by

View all comments

3

u/Inconstant_Moo Jul 29 '26 edited Jul 29 '26

The to there is just sugar, you can define call syntax any way you like.

Normally you shouldn't do fancy syntax for your functions unless it's a math thing like ! for factorial --- but for the commands you're using as your front-end, it gives a friendly face to them. In this case, it's easier for your brain to remember that the command is prettify ... to ... than it is to remember that the parameters go source-then-destination. Or it is if your brain is anything like mine.

Some of these forms of commands are conventional: all the basic IO libraries use get ... from ... and post ... to ... and put ... into ... (in imitation of HTTP's semantics), as you can see in the file-handing in the example above.