On Tuesday, March 5, 2013 7:05:47 PM UTC-6, Ian Lance Taylor wrote:
On Tue, Mar 5, 2013 at 3:41 PM, bryanturley wrote:

Test on pointer equality are exactly why I don't like weak refs
What if it gets collected and something of the exact same type gets
allocated exactly where it used to live?
To detect that you would need two kinds of references defined for each
object of that type, a pointer and some unique key.
The idea is that if the weak reference is discarded, it is set to
zero. You can never have a pointer to a freed weak reference; that
pointer would have been destroyed. So this error can not happen.

Yeah in a gc world I can see this, it would always require a stop the world
gc though wouldn't it?
I think the first implementation of weak refs I worked with was done very
badly and I have been strongly biased against them since.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts


Follow ups

Related Discussions



site design / logo © 2021 Grokbase