Why is D unpopular?

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri May 20 07:01:09 UTC 2022


On Thursday, 19 May 2022 at 18:42:11 UTC, Walter Bright wrote:
> On 5/19/2022 3:15 AM, Siarhei Siamashka wrote:
>> Regarding safety and avoiding various sources of undefined 
>> behavior. Do you agree that "Implementation Defined: The 
>> built-in associative arrays do not preserve the order of the 
>> keys inserted into the array. In particular, in a foreach loop 
>> the order in which the elements are iterated is typically 
>> unspecified." from https://dlang.org/spec/hash-map.html can be 
>> a source of bugs in the user code?
>
> But still, languages draw a distinction between implementation 
> defined and undefined.

Some programming languages just maintain the order of insertion 
(Ruby, Crystal, Python, ...) for their associative arrays and 
this makes their behavior much more predictable and friendly to 
the developers.

Go intentionally randomizes the order of iteration over elements 
from its associative arrays, so that the unpredictable nature of 
it is much more visible to the developers and can be caught by 
unit tests.

Every little bit helps to improve safety. You skipped my comment 
about default unstable sort in Phobos, but such decision also 
erodes safety to some extent.


More information about the Digitalmars-d mailing list