Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, in your article you consider indexes then ultimately decide not to use them in favor of Vec<Box<T>> & pointers. I recommend that you use indexes instead. I think they’re the better choice.

> Could you tell me, please, where you read in the article that I assume it?

You assume it in your first attempt at solving this problem. You describe that attempt in detail. That’s what I’m referring to.

The code you ended up with is still dangerous code, because your boxes are still not guaranteed to remain pinned in memory.



A clear. I hid it in my mind. I haven't tried the approach with indices, because... well, I was lazy to do it. However, I agree that this approach would be better, then the current one.

> You describe that attempt in detail.

I appreciate if you put a quote, because I fail to find the description of the attempt in detail. In fact, instead of assuming that a vector is pinned I wrote this "I realized that the problem is related to the fact that vectors of children move in the memory if they don't have enough space to extend."

> The code you ended up with is still dangerous code, because your boxes are still not guaranteed to remain pinned in memory.

You are right, boxes are not pinned, but the data, which the point to, is pinned, isn't it? My pointers point to that part of memory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: