Hacker News new | ask | show | jobs
by moron4hire 1725 days ago
Yeah, I don't really see functional programming being that great of a fit for VR. I mean, the 3D environment is inherently object-oriented and stateful. And you're working in an extremely performance intensive task, such that pure immutability really starts to get in the way. Also, Haskell's lazy evaluation has a bad reputation for poor and/or unpredictable performance. It's better to have a higher mean execution time with an extremely narrow standard deviation so you can plan your frame budget and not occasionally blow it, dropping frames all over the floor.

What you want is something that puts the movement of memory between processes and threads front-and-center. Half the difficulty of writing a 3D rendering engine is coming up with a good memory model for loading 3D models and textures to push them onto the GPU. That really sounds more like Rust's wheelhouse than Haskell.

3 comments

I disagree on the 3D environment being inherently OOP. ECS, a popular paradigm in 3D and 2D game making, can map pretty well to functional programming.

I would pick Rust as well here but just because Haskell has exceptions and it has less emphasis on safety and less pleasant defaults than Rust. In order to get the Haskell I want I need several pragmas and a different prelude...

I would say Rust is pretty functional itself, though.

What? ECS is soooo object oriented. It's basically the modern OOP attitude of poo-pooing inheritance in favor of composition, writ-large. Yet, somehow, all the components have deep inheritance hierarchies themselves, so [shrug].
Today I'd definitely use Rust. Most of the rendering work is gone in Godot, which is C++.

GC hasn't been an noticeable issue as a result.

> the 3D environment is inherently object-oriented

What does it mean for the 3D environment to be inherently object-oriented?