On Sunday, 16 December 2018 at 04:02:57 UTC, Q. Schroll wrote:
On Thursday, 13 December 2018 at 23:33:39 UTC, Stanislav Blinov wrote:
On Thursday, 13 December 2018 at 13:17:05 UTC, aliak wrote:

Ah. Is there any case where you would not want to do that when you have a T value as parameter?

Hypothetically, yes, e.g. an object that contains references to itself. However, D operates on the assumption that you don't have such objects.

The spec actually forbids you creating self referencing structs. DIP 1014 tackles that. For the spec, see https://dlang.org/spec/garbage.html#pointers_and_gc

I know. What I mean is (what you left out) the language can't statically check that, so even if you were to violate the spec in that regard, you won't get any help from the compiler, and only a little from a handful of library functions. At runtime.

Reply via email to