On 4/30/14, 1:34 PM, Vladimir Panteleev wrote:
On Wednesday, 30 April 2014 at 20:29:37 UTC, Andrei Alexandrescu wrote:
On 4/30/14, 11:15 AM, Dmitry Olshansky wrote:
It doesn't and CAN'T. As long as there is a pointer into the block it
stays. There are plenty of ways to shoot yourself in the foot if this
rule is not respected. Anyhow, for starters, a conservative GC doesn't
know what is a slice when ptr/length sits in registers!

Yah, if you find a register possibly pointing somewhere in the middle
of an array, all bets are off.

But let's say that's not the case and all that's pointing in a 1M
elements int[] is a int[] of 5 elements somewhere in the middle. Do we
want to support these?

s = s.ptr[-1 .. $ + 1]

and such?

I guess this is related to the reason Java switched its substring method
to make a copy instead of hold a reference?

It it related, but not necessarily a motivator. I came to this naturally while designing allocators. -- Andrei

Reply via email to