Re: [go-nuts] Is this implementation of weak pointers safe?

2018-10-01 Thread Ben Lubar
On Sunday, September 30, 2018 at 6:53:47 PM UTC-5, Dave Cheney wrote: > > Please don’t take os.File as justification, it’s one of the few uses of a > finaliser in the std lib. If it were being written today I would argue that > instead of silently closing the file, it should panic if the

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-30 Thread Dave Cheney
Please don’t take os.File as justification, it’s one of the few uses of a finaliser in the std lib. If it were being written today I would argue that instead of silently closing the file, it should panic if the resource falls out of scope unclosed. As always, remember that finalisers are not

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-30 Thread Ben Lubar
On Sunday, September 30, 2018 at 4:56:20 PM UTC-5, Kane York wrote: > > In Go, it's usually better to use source code analysis to look for > forgotten Close calls, like the existing tooling for os.File (which does > have a finalizer, but doesn't need to). *os.File has a finalizer for the same

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-30 Thread 'Kane York' via golang-nuts
In Go, it's usually better to use source code analysis to look for forgotten Close calls, like the existing tooling for os.File (which does have a finalizer, but doesn't need to). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-30 Thread Ben Lubar
On Sunday, September 30, 2018 at 4:00:32 AM UTC-5, Tamás Gulácsi wrote: > > 2018. szeptember 30., vasárnap 6:20:37 UTC+2 időpontban Ben Lubar a > következőt írta: >> >> On Saturday, September 29, 2018 at 2:49:19 PM UTC-5, Ian Denhardt wrote: >>> >>> Quoting Ben Lubar (2018-09-29 14:40:28) >>> >

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-30 Thread Tamás Gulácsi
2018. szeptember 30., vasárnap 6:20:37 UTC+2 időpontban Ben Lubar a következőt írta: > > On Saturday, September 29, 2018 at 2:49:19 PM UTC-5, Ian Denhardt wrote: >> >> Quoting Ben Lubar (2018-09-29 14:40:28) >> >[1]https://play.golang.org/p/iBAii-f84Sq >> >vet is complaining because the

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-29 Thread Tamás Gulácsi
Why do you want a weak pointer? What for? -- 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+unsubscr...@googlegroups.com. For more options, visit

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-29 Thread Ben Lubar
On Saturday, September 29, 2018 at 2:49:19 PM UTC-5, Ian Denhardt wrote: > > Quoting Ben Lubar (2018-09-29 14:40:28) > >[1]https://play.golang.org/p/iBAii-f84Sq > >vet is complaining because the unsafe.Pointer usage would normally be > >dangerous around the garbage collector, but

Re: [go-nuts] Is this implementation of weak pointers safe?

2018-09-29 Thread Ian Denhardt
Quoting Ben Lubar (2018-09-29 14:40:28) >[1]https://play.golang.org/p/iBAii-f84Sq >vet is complaining because the unsafe.Pointer usage would normally be >dangerous around the garbage collector, but since I have a finalizer on >the "real" pointer and there is no way the code could

[go-nuts] Is this implementation of weak pointers safe?

2018-09-29 Thread Ben Lubar
https://play.golang.org/p/iBAii-f84Sq vet is complaining because the unsafe.Pointer usage would normally be dangerous around the garbage collector, but since I have a finalizer on the "real" pointer and there is no way the code could access the uintptr with the same value as the real pointer