News for hackers. Stuff that matters.
Re:FOAM: New JavaScript Framework by Google Engineers by seanmcdirmid on Monday April 27, 2015 @06:30AM (#9445349)
Rendering code is easy to express as pure functions...that is mostly how OpenGL and DirectX work, after all. React doesn't help very much with the state of your application (nor is it meant to). That being said, being able to treat the DOM as something to be rendered efficiently in immediate mode is quite useful.
Re:FOAM: New JavaScript Framework by Google Engineers by eropple on Monday April 27, 2015 @10:05AM (#9446336)
OpenGL is a big ol' box of state in almost everything it does. I'm not sure how you get pure functions out of that.
Re:FOAM: New JavaScript Framework by Google Engineers by seanmcdirmid on Monday April 27, 2015 @10:29AM (#9446502)
Immediate shader mode is fairly stateless, pixel and vertex shaders are as functional as one can get. Let's not talk about the fixed function APIs that no one uses anymore.
Re:FOAM: New JavaScript Framework by Google Engineers by eropple on Monday April 27, 2015 @10:47AM (#9446617)
I'm not sure what you mean by "immediate shader mode". Even direct state access mode is tweaking knobs in a state machine that can have very strange side effects if you don't re-set the state every time (and that's antithetical to pure functional programming). When not using DSA--I mean, just grep for "bind" in any OpenGL codebase...
Re:FOAM: New JavaScript Framework by Google Engineers by seanmcdirmid on Monday April 27, 2015 @11:07AM (#9446748)
The hardware has state that is exposed more or less directly, but texture management is all just plumbing and easily wrapped. Most of my experience is with directX though, which seems to have a much cleaner API.

Anyways, immediate mode UIs abound for game stacks given the ease at which they can be mapped to the GPU directly.

Re:FOAM: New JavaScript Framework by Google Engineers by eropple on Monday April 27, 2015 @11:11AM (#9446773)
DirectX still uses stuff like ID3D11DeviceContext::PSSetShaderResources to set application-global state that's required to do anything. It is fundamentally stateful and non-pure. I'm not sure why you're trying to argue this point.