D array expansion and non-deterministic re-allocation
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Nov 18 10:00:54 PST 2009
Bartosz Milewski wrote:
> Andrei Alexandrescu Wrote:
>
>> My concern is the semantics of the language. As it is defined right
>> now, a conforming implementation is free to use a quantum random
>> number generator to decide whether to re-allocate or not. Is it
>> likely? I don't think so; but the non-determinism is part of the
>> semantics of D arrays.
>>
>> It would not be difficult to specify in the language definition
>> (and TDPL) that behavior is deterministic for a given platform. I
>> think this has some impact on the freedom of the memory allocator,
>> but probably not major.
>
> Actually this wouldn't fix the problem. Although this would make the
> program deterministic, it would still exhibit chaotic behavior (and
> chaos is a pretty good simulator of non-determinism--see random
> number generators).
I am glad you have also reached that conclusion.
> An input string that is one character longer than in the previous run
> in one part of the program could cause change in allocation in a
> completely different part of the program (arbitrary long distance
> coupling).
Then you must restart your argument which was centered around
non-determinism. It starts like that: "I read Andrei's chapter on arrays
and there's one thing that concerns me. When a slice is extended, the
decision to re-allocate, and therefore to cut its connection to other
slices, is non-deterministic."
Andrei
More information about the Digitalmars-d
mailing list