Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really like how purity in D is so... practical. I like that a for loop is totally allowed in pure code as long as it modifies no data outside the pure block. One of the most annoying things in Haskell was to translate some algorithm that looks very natural in a for loop into some other sort of combination of map or reduce or something even more complicated.

(Yes, I know Haskell can also fake for loops more cleanly with monads, but they still feel awkward and unnatural.)



My recollection from the last time I worked with D was that pure could be more complicated and strict than expected when using standard libraries functions, e.g. using trigonometry sets hardware global state, thus impure. I don't remember if there was a good workaround to convey intent of purity despite that.


In D "pure" means "referentially transparent".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: