Asked on Reddit: Which of Rust, D, Go, Nim, and Crystal is the strongest and why?

Dave via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 10 11:13:52 PDT 2015


On Wednesday, 10 June 2015 at 17:34:55 UTC, jmh530 wrote:
> 3) Immutability by default. Someone (somewhere) made an 
> interesting point that it can be conceptually convenient to 
> have the most restrictive choice as the default. I'm not sure I 
> agree with that (maybe the most common choice used in good 
> code), but at least immutability by default it can be helpful 
> for concurrent programming.

I am one of those that think that a language should allow you to
do whatever you want, but be restrictive by default. For example
immutability unless you explicitly ask for mutability (like in
Rust). D sort of has the ability to do this, but it's sort of
backwards due to it's defaults. For instance D is mutable by
default (an inherited trait due to the C subset of the language),
with the ability to explicitly mark values as immutable. Another
backwards annotation is nothrow. I don't really care if something
doesn't throw, I care when it throws, because then I have to do
something (or my program may crash unexpectedly). Even if the
enforcement is kind of there (although unannotated functions can
do whatever), it would have been a better guarantee to disallow
this by default.

Then you have purity, garbage collection and final which also
seem backwards from what they should have been (although better
arguments can be made for these than immutability and nothrow). D
did get thread local storage correct, but I think people are
starting to get on board with having restrictions by default
because it prevents bugs (and the annotations are grepable). Kind
of like what Rust is doing. If this is the case, D might find
itself being discarded in favor of languages that offer better
guarantees.

Just a thought from a random spectator ;)


More information about the Digitalmars-d mailing list