3 ms·
> Go has a long list of booby traps like this Huh? Where’s the list? From the top of my head I think this is the only thing that repeatedly bit me, although I’
by thiht 3y ago
> Go has a long list of booby traps like this
Huh? Where’s the list? From the top of my head I think this is the only thing that repeatedly bit me, although I’m very aware of the behavior of for loop scoping. Linters save me nowadays at least.
Are there other things like that in the language that deserve a fix? Maybe things to do with json un/marshaling?
- the_gipsy 3y agoMy number one is not having algebraic/sum/union types leading to needing zero-values. Which is more like a never idling foot gatling gun.
- deleted 3y ago[deleted]
- wazzaps 3y agoCopying a mutex by value (thus duplicating the lock, causing deadlocks or worse) is far too easy
- icholy 3y ago`go vet` catches this.
- mhh__ 3y agoI use a tool called "type theory"
- icholy 3y agoKeep posting about D, I'm sure it will catch on soon.
- erik_seaberg 3y agoIs there a way to declare any type uncopyable? This is something I always thought Ada got right.
- deleted 3y ago[deleted]
- smasher164 3y agoyou stick this in your struct type noCopy struct{} func (*noCopy) Lock() {} func (*noCopy) Unlock() {}
- usefulcat 3y agoWow, even c++ won't let you do that (without invoking undefined behavior, anyway).
- nu11ptr 3y agoIt has been a while, but yes, there were a lot of them and I forget most. It made it kinda pointless to me that the language was "easy" when the code felt so brittle (Null pointers...really?). One weird thing that always goofed me up was that slices are passed by value but maps by reference. Always made it confusing how to pass them for serialization/deserialization. The compiler didn't complain it just panicked. Seemed like something the type system should catch.
- skitter 3y agoIf you append to a slice, you can't rely on the changes showing up in the original slice, nor on them not showing up.
- kevincox 3y agoThat the printf functions shit garbage into your output if you get the formatting specifiers wrong. I'd much rather have a crash than silently corrupting output.
- telotortium 3y agoTyped versus untyped nil (not sure how this could be easily fixed though)