4 ms·
Purity in D
- klickverbot 14y agoI am the author of the linked article – feedback and comments of any kind are very welcome!
- minoru 14y agoThere is an issue with quotes — they appear to be swapped (tiny screenshot here: http://ompldr.org/vZHl4Mw http://ompldr.org/vZHl4Mw). I made a little check, it's the same with every font you specified in your CSS, so the problem must lie within your blog generator or something.
- klickverbot 14y agoIn German, guillemets are actually only used like that – contrary to, for example, French. I got in the habit of using them almost exclusively, and usually enter them explicitly (most non-Windows keyboard layouts have them in a convenient location). If this is confusing to non-German readers, though, I suppose I should reconsider their use.
- minoru 14y agoOh, I didn't know that — thanks! But yes, to me it looked like I had some fonts wrong or something.
- Rickasaurus 14y agoI was disappointed by the '›Weak‹ Purity Allows for Stronger Guarantees' section. I expected an explanation of why weak purity might give stronger guarantees, but what I got was a set of reasons why weak purity is more practical for a compiler that can't handle FP optimizations. Where's the stronger guarantees?
- klickverbot 14y agoReferring to the toy example from the article: Without »weak« purity, renderScene() could not be pure at all, but now, it can even be »strongly« so. The point is that it enables some function to be pure in the traditional sense even if their implementation relies on mutating data – any idea how I could make this more clear?
- minoru 14y agoWhen I read that section, it occurred to me that "weak purity" is like monads and "strong purity" is purity as we know it in the FP world. Then drawTriangle() become an action in some monad (I imagined a State one) and renderScene() is just a pure function using some monadic computations (doing something like evalState (drawTriangle ...)). I don't know how to explain that without analogies to Haskell (which, I presume, author deliberately avoids), though.
- klickverbot 14y agoYes, I deliberately tried to avoid using FP slang as to not scare away interested C++ programmers. This is also the reason why I referred to I/O »in the classical sense« instead of mentioning the m-word. ;)