5 ms·
Go is memory-safe. See also https://en.wikipedia.org/wiki/Memory_safety https://en.wikipedia.org/wiki/Memory_safety
by secure 9y ago
Go is memory-safe. See also https://en.wikipedia.org/wiki/Memory_safety https://en.wikipedia.org/wiki/Memory_safety
- Ixiaus 9y agoAre there not many statically typed, compiled languages that ship a runtime with a garbage collector? Why is Go a good choice here? Why is this choice better than a language that provides memory safety using linear types so you don't even need a runtime or garbage collector?
- secure 9y agoYou can read more about why I like Go at https://michael.stapelberg.de/posts/2017-08-19-golang_favorite/ https://michael.stapelberg.de/posts/2017-08-19-golang_favori.... Of course I used my favorite programming language for building gokrazy :).
- pknopf 9y agoHey, the creator of i3! I love your stuff! I enjoyed your episode on Go Time as well! Cheers!
- secure 9y agoGlad you like my work; thanks for the kind words!
- crispinb 9y agoI've only dipped into Go recently (and not for any production code) but your article very nicely summarises my impressions with it so far. I've found a kind of fluid pleasure in writing Go that wouldn't be apparent from a bullet list of its (lack of) features. It really allows my attention to fall mainly on the problem domain in a way few other languages afford. I can't resist while here thanking you for i3. I've been a mac user recently, but will likely be back to linux in the next year or so. Using i3 again will be probably be the greatest pleasure involved in that return ;)
- lsaferite 9y agoI've added gokrazy to my list of things to play with over the weekend (when I theoretically have time, hah). One question I'd ask in context of the other poster, can I easily run a Lua VM and tie it into the gocrazy env so that a Lua app would appear like a go app?
- secure 9y agoIt might be possible to do this, but certainly not easily. gokrazy’s unit of application is a Go package, so you’d need to write a Go program which then executes the Lua VM. I don’t know what dependencies Lua has — if it cannot be compiled statically, I’d recommend against using Lua in this context.
- matthewmacleod 9y agoAre there not many statically typed, compiled languages that ship a runtime with a garbage collector? Not really a huge number, no. Java is probably the most obvious, if you count that as compiled. Maybe Haskell or D? I suppose even Swift of Objective C if you include RC in the definition of GC. I would say the focus shouldn't be entirely on GC, however. Safety as a whole is the most important factor, and it's possible to be say without GC, as you point out. I reckon Go is actually quite an attractive language for this sort of application regardless – quite safe, quite lightweight, good libraries.
- simmons 9y agoThere are a number of languages that meet the memory safety criteria, and they each have tradeoffs that may make them a good choice for a certain range of use cases. This project happens to be based on Go, but similar projects in other languages would be interesting as well.
- millstone 9y agoGo is not memory safe (though is certainly safer than C++). Various Go constructs like interfaces and slices are implemented via non-atomic multiword structs, and data races may result in invalid values leading to memory corruption, etc. See https://blog.stalkr.net/2015/04/golang-data-races-to-break-memory-safety.html https://blog.stalkr.net/2015/04/golang-data-races-to-break-m...
- hoosieree 9y agoIs there any language not safer than C++?
- viraptor 9y agoMany. I like bashing C++ as much as the next dev, but modern C++ has nice type checks, interesting types/wrappers which help with common patterns (shared, unique ptrs, etc), and the compilers learned some great tricks which allow you to run memory safety checks yourself. (Asan and others) Also multithreading gets some improvements which will take more of the manual sync details away from the business logic. (http://www.modernescpp.com/index.php/multithreading-in-c-17-and-c-20 http://www.modernescpp.com/index.php/multithreading-in-c-17-...) It's still delivered attached to a foot-gun, but you could do worse.
- sagichmal 9y agoYours is a stricter and not-commonly-used definition of "memory safe", which typically means "in the C sense" i.e. pointer arithmetic and bounds checking. Go is certainly memory safe by the typical definition.