4 ms·
There are other reasons to use D, and indeed, most of the community came from languages without pure functions and did not want the feature before trying it. H
by Tuna-Fish 13y ago
There are other reasons to use D, and indeed, most of the community came from languages without pure functions and did not want the feature before trying it.
However, it's one of those things where once you use it for a while, you begin to really appreciate it. Better optimization, autovectorization and cpu -> gpu code conversion are all unimportant reasons for checked purity in the type system. The important reason is that by constraining what functions do, it makes reasoning about complex systems easier.
Generally, after you've worked in maintenance on one large project that designed everything to be pure unless there's a very compelling reason not to, you start to really miss the feature when you go back to projects in languages without it.
- catnaroek 13y agoAgreed there. But, on the other hand, D misses out on statically checked resource management, and IMO that is more important than purity in the niche Rust and D are targeted at (systems development). Of course, nothing prevents a language from having both. :-)
- WalterBright 13y agoPurity has a large advantage when writing concurrent code, as pure functions don't need to be synchronized. This is why D has enforced purity (via an attribute) rather than inferred purity.