HigherOrderCO/hvm-64

side effects?

nivkner opened this issue · 4 comments

with the removal of constructors, and use of GPU, how can HVM be used for general purpose programming?

in HVM1 the a constructor could be implemented by the runtime as a built-in function, which could then do side effects, so without them how are things like syscalls called?

in fact by reducing the network on the GPU you might not be able to do side effects at all since you don't have access to the CPU OS from the GPU.

This is just a wip, there are no syscalls yet.

let me rephrase: what is the plan for integrating side-effects into this version of HVM?

the constructors might be replaceable with something else in the future, but the use of the GPU fundamentally limits what can run on this implementation.

so if this HVM is meant to be used for general purpose programming (which requires side effects), and this repository isn't just to demonstrate that HVM can be fast, but is actually planned to be a future version of HVM, then shouldn't this be something to consider early?

syscalls can be done via a monadic interface as with other pure functional languages, being on the GPU doesn't prevent that in any way, although it does add some overhead communicating with the CPU. on the ideal, finished runtime, I believe most of the code should run on the CPU, with gthe GPU being an opt-in for specific functions (like, if you're rendering an image using pure recursive functions, you probably want that on the gpu)

@nivkner you may be interested in this explanation of how to interact with the outside world in a purely functional language: https://lean-lang.org/functional_programming_in_lean/hello-world/running-a-program.html#functional-programming-vs-effects

It's for the Lean language, but the same concept could be applied to hvm-core, too. It helped me understand things at least. 😁