goat
goat copied to clipboard
Structs, C ABI + always the most optimized field arrangement?
Is it possible to satisfy optimized field arrangement without re-ordering fields at compile time?
Yes.
Just force the developer to align fields in an optimized order, and throw a compiler error if they don't.
Why do this? I'm not sure exactly what the C ABI is, but I do know it has to do with field re-ordering in structs. It would be nice if Golang could comply with the C ABI, making it much easier to use Golang alongside C.
Go fmt
could automatically re-order fields for the developer on save to prevent the mental overhead of field re-ordering.