4 ms·
> But if I understand things correctly, go, the spec, doesn’t provide the developer a way to control field order. The spec doesn't, but the actual compiler imp
by usrbinbash 5y ago
> But if I understand things correctly, go, the spec, doesn’t provide the developer a way to control field order.
The spec doesn't, but the actual compiler implementation does. If the compiler is not allowed to re-order fields, they remain in the order the programmer specified in the code. That's why the fix in the article works in the first place.
- Someone 5y agoBut the compiler isn’t “not allowed to re-order fields”. The spec allows it to do that. This fix works for the current compiler, but may not do so for next week’s. Technically you could say it wouldn’t even be a breaking change if a compiler update changed that (practically people would have reason to be angry if they slipped something like that in without creating a major version and adding warning flags to the release notes)