Sorry if the question is a little vague. Lately, I’ve been exploring functional languages, and I’m really ill-informed about them.

I’m aware that most of these languages use some sort of garbage collection or reference counting, also that they’re (slightly) slow, and that there’s no other way for them to clear their memory manually apart from having to use inline C/C++. I know that some functional language can convert to C, but I’m not really interested in that.

I would like to understand if a system programming language, that is also purely functional, exists? If so, how does memory management work in such circumstances? Can be accommodated in a way such that it helps in the creation of, let’s say, the OS kernel, and not the other way round. Can it run without having to use any inline assembly/C/C++ code?

If not pure functional languages, then what about impure ones?

  • @xmunk@sh.itjust.works
    link
    fedilink
    10
    edit-2
    12 days ago

    A pure functional program can not have any I/O, but yes, they exist.

    They’re generally considered pretty useless in terms of our modern view of what a computer should be (an interactive object) instead, purely functional languages are great for traditional computers (something used for computing i.e. math solutions).

    Purely functional languages can do extremely complex things but, at the end of the day, you’re writing a program to solve a single starting state and that program will always resolve to the same output (and the occasional rabid functional purist will argue that a program “return” is itself a side effect).

    I love functional-ish programming, where as much of the program as I can manage is side effect free and those aide effects are limited to the fringes of the program where it needs to interact with I/O (read/writing from a disk, database, cli, GUI, whatever) as that seems like the most powerful balance to me.

    Oh, and lately, I’ve done a lot of my functional programming in PHP… most modern languages have a good support for functional programming in a limited context.

  • @Thann
    link
    English
    312 days ago

    Lambda calculus