internment icon indicating copy to clipboard operation
internment copied to clipboard

Added InternTable

Open zesterer opened this issue 5 years ago • 3 comments

I was unable to use the macro for trait impls since it does not support lifetimes.

zesterer avatar Feb 27 '20 01:02 zesterer

This commit looks like it lacks documentation and tests. Both are needed for me to accept the pull request.

I think that I can see the goal, which is to enable arena allocated interned pointers. I think in this case you should be able to implement it without unsafe, though.

droundy avatar Feb 28 '20 15:02 droundy

Yep, that's fair. I'll try to find some time to push this to completion over the next week.

zesterer avatar Feb 29 '20 15:02 zesterer

I've finally gotten around to taking a look at this, and it looks interesting. When I look at it, however, it seems like the borrow checker would prevent you from interning more than one object in a table, since the lifetime of the first entry would make the compiler think a borrow of the table is ongoing.

I haven't tested this, but it's worth putting in an example or test to demonstrate that it's not a problem.

droundy avatar Jun 26 '20 14:06 droundy