4 ms·
This is the type of issues that nicely lead to security bugs It's also the type of functionality that enables the efficient use of high performance C libraries
by personZ 12y ago
This is the type of issues that nicely lead to security bugs
It's also the type of functionality that enables the efficient use of high performance C libraries and existing code (I use it to great effect with the Intel compiler for extremely high performance SIMD code).
The "someone might not use it right, therefore it's anathema" notion is misguided, and is orthogonal with the philosophy of Go. Even C# and Java -- the pinnacle of "enterprise" languages -- understand and respect the notion of pointer sharing, and early on built in mechanisms to support it. Go is a league above, though, given that it follows C struct layout rules.
But I see where the person proposing banning it got their notion from -- it's a classic hubris of "if it isn't important to me, it isn't important to anyone". A compacting GC has benefits, but the lazy notion of wholesale blocking broad and powerful uses because one doesn't personally benefit from them is how languages die.
- pjmlp 12y agoJava and .NET offer GC free allocation for such purposes, via their interop APIs. This is also one area that is being improved in Java 9 (Arrays 2.0, Value Types and the new FFI). But as I mentioned, thus agreeing partially with you, pin/upin could be enough.
- voidlogic 12y agoAlthough I would perfer pin/unpin, You could easily implmement GC free allocation in Go and people do. Its not hard to write a library for explicit memory management: 1. mmap some memory 2. Write or port malloc and free like functions This implementation could probably even use sync.Pool to good effect.