15
submitted 4 months ago by velox_vulnus@lemmy.ml to c/programming@lemmy.ml

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?

top 2 comments
sorted by: hot top controversial new old
[-] xmunk@sh.itjust.works 11 points 4 months ago* (last edited 4 months 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@lemmy.ml 3 points 4 months ago

Lambda calculus

this post was submitted on 07 May 2024
15 points (100.0% liked)

General Programming Discussion

7740 readers
2 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 5 years ago
MODERATORS