20-Jan-2014 23:41, Steven Schveighoffer пишет:
On Mon, 20 Jan 2014 14:22:34 -0500, monarch_dodra
<[email protected]> wrote:
On Monday, 20 January 2014 at 12:27:41 UTC, Dicebot wrote:
Quick dlang.org investigation has found this:
http://dlang.org/phobos/std_exception.html#.pointsTo
Note:
Evaluating pointsTo(x, x) checks whether x has internal pointers.
This should only be done as an assertive test, as the language is
free to assume objects don't have internal pointers (TDPL 7.1.3.5).
I guess you may want to check mentioned TDPL part ;)
Yeah, I remember the pull that added that comment. As a matter of
fact, it was I that brought up said part in the original pull.
It basically says "dmd assumes no internal pointers for its move
semantics" :/
Um.. that should only apply to stack-allocated items. Heap allocated
items are fine to point to themselves, even structs.
Consider that cycles are allowed, and planned for, in the GC. An
internal pointer is essentially a 1 element cycle!
Makes sense... Then allocating on GC heap is fine.
A simple logical evaluation of how a moving GC would work reveals that
it should update internal pointers as well as all other pointers.
-Steve
--
Dmitry Olshansky