Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't buy this. The paradigm I use often depends on the level of abstraction I'm working with. A functional runtime is ultimately built upon an imperative foundation. I write mostly purely functional code in Scheme, but from time to time I add my own imperative components to the foundation. I don't really want to use languages that restrict me to a single paradigm.


> A functional runtime is ultimately built upon an imperative foundation.

Memory safe languages are ultimately built upon an unsafe foundation.


Sorry if I'm being dense here, I understand the pattern of argument you're using, but I just don't understand what point you were trying to make. Could you explain?


It's an abstraction. If it's solid, it doesn't matter what's underneath.


Sure, I agree. My point is that sometimes we have to build these abstractions, so I like to use languages where I can program mostly in a functional style, but use another paradigm when appropriate.


> but from time to time I add my own imperative components to the foundation

Why? Do you not know how to perform a specific task within functional code?

In which case, you should probably take that opportunity to find out how to do it.


>Do you not know how to perform a specific task within functional code?

It's not that I didn't know, it's that the process was imperative at its core. For example, I am working on a rendering engine using OpenGL. The high-level scene graph interface is purely functional, but rendering such a scene graph is an imperative process: binding textures, vertex arrays, shaders, writing to a framebuffer, etc. This low-level rendering code is the functional runtime for the high-level API.


Ah, I see.

You could do that within a purely functional language (via monads), but given how locked to C and the imperative paradigm OpenGL is, it would make sense to simply write that in C, yes.


I think monads are orthogonal to this issue. Using a monad would provide a pure interface around the imperative stuff, but the imperative stuff would still be there. Someone's gotta write the gross stuff so that we can build our pleasant, pure world on top of it.


> A functional runtime is ultimately built upon an imperative foundation.

Not necessarily. Functional language compilers are very sophisticated and do not necessarily compile code the way you might think.


The functional runtime (i.e. not compiler) is built upon an imperative foundation. This is necessarily so as long as hardware computer are built upon state-modifying processors and random access, in-place updatable memories.


So what? It's Turing-complete so it can simulate any non-Von Neumann machine that can compute. And in fact it does so very well, see Forth, Lisp, and other languages from different paradigms for which there are dedicated processors.

If you use an abstraction (your job as a programmer) the innards of the processor should approach inconsequential.


That code is ultimately compiled to run inside of a register machine. A language may give you a functional interface to something like disk I/O, but the underlying implementation is inherently imperative. Or how about the purely functional programming language Elm, whose runtime is imperative JavaScript?

For the record, I prefer purely functional programming, but it's not the only tool in the tool box.


> That code is ultimately compiled to run inside of a register machine.

It is, but the code barely resembles the code most imperative programmers would write.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: