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

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 10 12:44:29 PDT 2015


On Wednesday, 10 June 2015 at 18:13:53 UTC, Dave wrote:
> 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.

I usually agree that the more restrictive option should be the 
default, but exceptions is... well... the exception. The whole 
point of the exceptions system is to limit the number of points 
where you need to worry about something going wrong to the place 
where it happens and the places where you want to do something 
special with it. nothrow by default means you can't do that - you 
have to care about the exception at every single point in 
between. The result is a better syntax for the exact same thing 
the exceptions idiom was supposed to prevent...


More information about the Digitalmars-d mailing list