3 ms·
TBH go does have a lot of weird magic stuff. For example: - types vs type aliases - the init function - how you define a struct can have significant impact
by aaomidi 3y ago
TBH go does have a lot of weird magic stuff.
For example:
- types vs type aliases
- the init function
- how you define a struct can have significant impact on performance. There are lints that align struct better.
- changing a returned value in a defer function. Very useful but can easily hide complexity.
- interfaces are.. weird. They can also easily hide weirdness.
- richbell 3y agoBuild directives are magic comments. Embed is a magic comment but you also need to import it. Weird magic syntax to declare enums. Etc.
- liampulles 3y agoI was not very explicit on what magic means to me (so fair do's). By magic I mean logic of a program which is not plain function calls, conditionals, etc. or unexpected/hidden logic. In that light, I agree init calls and defers are a bit magic. I'll even add panics in there. But I don't use these much personally, so I'm hesitant to say it is a lot of magic - especially compared to something like Java for example.