Remix.run Logo
Mond_ 11 hours ago

This is begging the question. Yes, but why did they do that over dedicated syntax?

(My personal theory is that early go had a somewhat misguided idea of simplicity, and preferred overloading existing concepts with special cases over introducing new keywords. Capitalization for visibility is another example of that.)

6 hours ago | parent | next [-]
[deleted]
thwarted 10 hours ago | parent | prev [-]

//go:xyz is dedicated syntax that is compatible with both the language spec and other toolchains that don't know about it.

4 hours ago | parent | next [-]
[deleted]
debugnik 36 minutes ago | parent | prev | next [-]

Good luck compiling on a toolchain that doesn't know about //go:embed or /* */import "C" comments.

Mond_ 10 hours ago | parent | prev [-]

It's an overloaded comment. I am personally quite fine with it, I don't think it's bad. but it is an overloaded comment.

thwarted 9 hours ago | parent [-]

I'm no longer sure what you're saying. You asked why they didn't go with dedicated syntax, I listed two advantageous aspects of the chosen syntax. We know it's an overloaded comment: that's literally one of the advantages.

Mond_ 5 hours ago | parent [-]

Well, I've been unable to follow you as well, then. Obviously if they'd used a different type of syntax (e.g. using # for annotations), those would also be compatible with the language spec, and other implementations would still be just as capable of ignoring all unknown annotations.

(Though for the record, talking about alternative implementations when discussing Go is kind of a funny joke.)

overfeed 2 hours ago | parent [-]

Is gccgo a joke to you?

debugnik 21 minutes ago | parent [-]

Maybe? It's stuck in 1.18 without generics and no one has replaced its maintainer, Ian Lance Taylor, who seems to have moved on after leaving Google.

But to be fair to alternatives toolchains, TinyGo and TamaGo are also a thing.