2 ms·
> graphical shaders are functional even if they look like C :) Many inputs one output and no side effects :) That's not functional programming, it's just pure
by MaxBarraclough 7y ago
> graphical shaders are functional even if they look like C :) Many inputs one output and no side effects :)
That's not functional programming, it's just pure functions. Shaders make use of sequential execution of statements, and they don't support recursion.
- alecmg 7y agoyou are splitting hair on definitions. It is the pure function nature of functional programming that makes it easy for concurrent and parallel tasks. Recursion is neither here nor there
- MaxBarraclough 7y agoIt's not hair-splitting. As I understand it, functional shader languages are an active area of research. Mainstream shader languages such as HLSL are most certainly not functional.
- ajuc 7y agoLanguages are functional if they support higher order functions, recursion, closures, etc. Code is functional if it separates side-effects to small, clearly marked parts of the codebase.