r/learnprogramming • • 5d ago

Topic [Homework] How is Go actually standardized if there's no ISO standard? (Conflicting answers)

Hola a todos,

Estoy trabajando en una tarea sobre la estandarización de lenguajes de programación. Dado que Go no está regulado por un organismo externo como ISO o ECMA, he estado investigando qué reglas sigue, pero encuentro respuestas contradictorias.

Algunas fuentes señalan la Especificación del Lenguaje Go como lo más parecido a un estándar formal. Otras enfatizan que no existe una base independiente y que el lenguaje está completamente dirigido por el Equipo Go de Google. Por otro lado, algunos argumentan que herramientas como gofmt y la Promesa de Compatibilidad de Go 1 son las que realmente normalizan el ecosistema.

Intento comprender el panorama general para mi tarea. ¿Podría alguien explicarme cómo encajan todas estas piezas?

¿Cuál es la respuesta definitiva? ¿Se considera la Especificación del Lenguaje el estándar oficial, o la estandarización en Go se logra únicamente a través de la gobernanza de Google y las herramientas de la comunidad?

No necesito un ensayo completo, solo una explicación clara de qué debo citar como el "estándar" para Go. ¡Gracias!

En resumen: Go no está estandarizado por la ISO. Si tuvieras que escribir un ensayo sobre cómo se estandariza Go actualmente, ¿qué documentos, entidades o herramientas citarías y por qué?


Thank you all so much for taking the time to answer this thread from a young university student who isn't very familiar with the topic. I truly appreciate it from the bottom of my heart. I'll leave this space open for anyone who wants to continue commenting or learn more about what's below. Without a doubt, I was able to answer my question. Thank you.


31 Upvotes

38 comments sorted by

61

u/minneyar 5d ago

First, keep in mind that there's nothing magical about ISO. Anybody can call themselves a standards body. A lot of people respect ISO and use standards published through them, but nobody has to do that.

Go is owned and developed by Google, and as such, the Go language specification ( https://go.dev/ref/spec ), which is owned and maintained by Google, is the standard. I wouldn't even describe it as "the closest thing to a formal standard", it is a formal standard, just not one that is managed by ISO.

1

u/MousseNo1453 5d ago

I understand. And from what I've read, you're absolutely right. In this case, I'm advised to put "Go language specification" as the answer to my homework question. Or how could I phrase it?

13

u/binarycow 5d ago

Yes. The Go language specification is the specification.

7

u/Warm-Republic-1913 5d ago

Go has no ISO-style standard, but it does have a normative document: the Go Language Specification is the closest thing, and the compiler and standard library are expected to follow it. Changes to the language go through the Go team's public proposal process, which is why people say the Go team directs it. The Go 1 compatibility promise adds that programs written for Go 1 should keep compiling and running with later Go 1.x releases, with a few documented exceptions. gofmt is different, since it standardizes code formatting rather than the language itself. For an assignment I would cite the specification as the standard, and describe the proposal process and the compatibility promise as how it is governed and kept stable.

1

u/MousseNo1453 5d ago

I understand the idea. Of course, and it makes perfect sense. Thank you so much. This has been the most direct answer so far, haha.

1

u/MousseNo1453 5d ago

And yes, of course, my question wasn't entirely clear, because besides this report, there are others that added to it, which is why such a long thread was created, with changes that keep expanding. But of course, you can't just write randomly; there had to be a reason for it.

13

u/edwbuck 5d ago

ISO is just one organization that ensures standards are up to a certain quality, and verified to be followed by those with their ceritification.

Golang is a product of Google, and they maintain a less rigorous internal standard, which is more accurately called, their current design choices and the parts of the implementation they find expensive to change. It's barely a standard, and as an example, they don't even address (in it) their handling of floating point numbers. You're just supposed to assume it's IEEE 754 floating point numbers, but if you find out it isn't, then they'll say something about how you over assumed what the standard didn't specify.

But that's just the tip of the iceberg. Go always favors current convention over reasonable requests. "true" and "false" should never have been permitted to be variable names, but the convention is to simply not do that.

package main;

func main() {
  var true = true;
  _ = true;
}

Yes, it is, unfortunately, valid go.

4

u/MousseNo1453 5d ago

Wow. I loved that example. So, for my assignment, would it be fair to say that the "standard" of Go is primarily the current state of its official implementation, supported by Google's internal design decisions, rather than a strict academic document? Or what would you put in my place?

4

u/edwbuck 5d ago edited 5d ago

I'd agree with that assessment, but would indicate that Go's standard is also moving, in the sense that the details are updated occasionally.

It's also important to note that Google has indicated that Go is to be backwards compatible, which means that any major design choices, are likely not going to change.

Personally, I think they should have made a lot of changes a long time ago. But the person that built the language was an "early pioneer" in the programming game that never quite got his due till now. And some of that shows through in his "making choices to be different" when being different doesn't really buy anyone anything.

For example, it is exceedingly valuable to assign something based on a condition. Say you want a default value, to be overridden by an optional parameter. Normally you would:

val setting = (override != null) ? override :  DEFAULT;

Which might seem odd, but is the ternary statement often present in languages going back to C. It has a long history, and in small doses is a real benefit. Golang indicates it has the more readable "if statement" so it's equivalent is

val setting = DEFAULT;
if override != nil {
  setting = override;
}

or perhaps

val setting;
if override != nil {
  setting = override;
} else {
  setting = DEFAULT;
}

which arguments about vertical lines of code, which impacts readability more than horizontal screen space (vertical is more precious, you have fewer lines than columns), led to go making this compromise

var setting;
if override != null { setting = override; } else { setting = DEFAULT; }

which somehow seems even worse in understanding and readability than the original (according to Go) obfuscated syntax of the ternary statement, and would require reconfiguing a lot of beautifiers to not rewrite into six lines.

And this is a tiny thing. It's probably the same machine language in any form. But since Go was corporate backed by a "programming great" that decided you can re-implement it if you need it, the language always feels incomplete, even in the areas where it isn't. And yes, one of the popular suggestions it so write.

func SetOrDefault(string value, string default) string {
  if value != null {
    return value;
  } else {
    return default;
  }
}

var setting = SetOrDefault(override, DEFAULT);

but then you don't have a function for every type, and you're likely to repeat for many types. So now it's

var setting = SetOrDefaultString(override, DEFAULT);

and they finally added generics to 1.18 so now we can go back to

var setting = SetOrDefault(override, DEFAULT);

Don't get me wrong, it's a decent language, but it's just a language that's learned tons from some aspects of programming and nothing from a lot from its predecessors. It takes a lot of stances on items that don't make a lot of sense.

1

u/MousseNo1453 5d ago

Yes, of course, and I understand the point. One of these aspects was what led me to start that thread in the first place. Not having a standard and being constantly changing, but at the same time wanting to maintain a vision, makes it complete and interesting for a thesis. But the question for my assignment is to answer what Standard or Normalization the Go language uses.

3

u/edwbuck 5d ago

Good luck on your assignment. I think you have what you need.

Relevant to your assignment, recall that items get added and changed with releases. 1.18 wasn't the only "change to the standard"

1

u/MousseNo1453 5d ago

Thank you so much! And that's a great final point—the Spec is a living document that evolves with each release (like 1.18 adding generics). I'll make sure to mention that in my assignment. THAAAAANKS!!!

3

u/Broad-Promise6954 5d ago

That's simply because, as the spec says, these are predefined identifiers, not keywords. They therefore follow the same rules as any other identifier.

1

u/MousseNo1453 5d ago

What can I say? That's what the assignment is all about, haha. Determining which standard Go uses. However, what you say is true. I'm starting to see it a bit like Latin Americans; each one has their own dialect even though they all speak Spanish, but nobody told them to speak that way, they silently accepted it. And of course, there's "The Language Specification," which is a guide, but since it's Open Source, the community has the final say.

3

u/edwbuck 5d ago

Yes, the spec defines an utterly stupid solution, just so the language doesn't have to check or fail on keywords.

4

u/Explorer651 5d ago

They fit together as different layers. The language specification defines the language, the Go 1 compatibility document is the Go team's promise that Go 1 programs keep compiling, and gofmt only standardizes formatting. Go 1 also ships two compiler suites, gc and gccgo, as implementations of that spec.

1

u/MousseNo1453 5d ago

Of course, they complement each other. Tell me, how can I phrase it for my assignment? And to be absolutely sure: Is the gc compiler (the standard toolset) considered the main reference implementation, while gccgo is just an alternative? Thanks for clarifying everything!

4

u/motific 5d ago

I wouldn't claim it is standardised because it is (as you say) "standardization in Go [is] achieved purely through Google's governance and community tools".

Google has a habit of decreeing something is a standard, and people accept it, or in other cases they'll just stuff the standards body with their own people and shout down any alternative opinions.

2

u/MousseNo1453 5d ago

Literally. That's just how it is. What could be the answer to the assignment?

4

u/motific 5d ago

That is the answer IMO. It is accurate to describe it as proprietary specification, to meet the criteria of a standard you would need to see it agreed by multiple vendors/interests even if a single body was responsible. Even where a language is standardised there may be competing standards to choose from.

3

u/MousseNo1453 5d ago

I will definitely use the term 'proprietary specification' in my assignment. Thank you so much for the clarity

3

u/michael0x2a 5d ago edited 5d ago

I agree with the other top-level comments posted so far in this thread. If you want a simple + concise answer, I think you already have it.

I'm posting this mostly because I wanted to expand a little on the underlying mechanics of programming language development and the "bigger picture".


Something worth noting is that the majority of programming languages today are actually not standardized, in the sense that there is most languages do not have external body like ISO/ECMA responsible for maintaining an implementation-independent standard or specification.

This is because there is actually minimal value to establishing this independent body for most programming languages. Most programming languages have only one single implementation (or one "primary" implementation). This in turn means it's simpler to just keep everything "in-house": have the people who own making changes to the underlying interpreter or compiler also be responsible for maintaining a spec and reviewing proposed changes to it. For example, Go has their Golang proposal process, Python has PEPs, Java has JEPs, and so forth.

For these languages, creating an independent body would have minimal value: all it would accomplish is introduce an unnecessary logistical/bureaucratic hurdle to making language changes.

(This organizational structure also explains why many languages do not have a formal specification, only an informal one. It is of course useful to maintain some sort of specification -- but if there is only one primary implementation, it is easy to leave some behavior unspecified and up to the implementation. This happens sometimes by accident and sometimes by design to help keep the overall spec simpler.)

Creating an independent body mostly only starts becoming useful when there are multiple independent implementations. This explains why languages like C and C++: in the past, each operating system vendor used to maintain their own C/C++ compiler. Today, most development has concentrated around GCC, LLVM/Clang, and MSVC -- but 3 separate compilers is still plenty of reason to maintain a separate body. Similar thing with JavaScript: each major web browser implementer maintains their own JavaScript engine, so it's useful to have an independent coordinating body.

Or to rephrase -- creating a formal standard and an independent body can be a useful tool both for communication and for helping manage the politics around a joint open-source project. But it isn't an intrinsically desirable end-goal in and of itself.

(Note: I am using the word "politics" neutrally here -- as in, "the art and science of government")

What is the definitive answer here? Is the Language Specification considered the official standard, or is standardization in Go achieved purely through Google's governance and community tools?

I would say this is mixing two different levels of concerns.

  1. Is there a specification for the technical behavior of Golang?
  2. How are changes to the languages made? Who ultimately has power/control over this process? What is the governance structure?

The answer to the former is a combination of the Go language reference. I would say this is an example of an informal spec -- it tries to be as formal and precise as it can. But it (understandably) does not define the exact semantics with mathematical precision, and so ultimately leaves some semantics up to current behavior of the Go compiler and runtime itself.

The answer to the latter is Google. They are the body that maintains ultimate control over the Golang language and how it evolves.

The open-source community does admittedly also have a fair amount of influence over the direction of Golang, both at the micro level via filing issues and pull requests or at the macro level via the official language change proposal process. But Google is the ultimate gatekeeper.

The community can and also have been overridden by Google before -- one prominent example of this was back around ~2018 when the Golang community spent a fair amount of time brainstorming/designing a module system for Golang (dep) only for it to be rejected in favor of an alternate design (vgo) by Russ Cox, the tech lead for Golang.

IMO this was probably the correct decision from a purely technical standpoint, but I do recall it caused some bruised feelings at the time.

For completeness, it's worth noting that there's actually a 3rd level of concern here -- who owns the legal and financial aspects of a programming language? E.g. the money to run the language's website, package manager, and associated infra, who maintains legal control over trademarks such as the programming language's name and logo, who hires and pays people to work on the language itself, etc...

For golang, the answer is still "Google". But in other languages (especially open-source ones), there often ends up being a split structure where one body owns the language design/evolution and the other the legal/financial aspects. But we're probably veering pretty far from your homework question at this point.

gofmt and the Go 1 Compatibility Promise

IMO these are both largely unrelated to the questions of standardization and governance.

I guess gofmt is a useful tool for helping projects that use Golang maintain a similar standardized style, but that is a completely separate thing from the standardization/specification of the programming language itself. We're using the word "standardized" in two different ways here.

The Go 1 compatibility promise is best viewed as a general guiding philosophy espoused by the Go language team (aka Google) and used to judge language change proposals. But a philosophy is not the same thing as a technical standard or a governance structure.

1

u/MousseNo1453 5d ago

Wow. Thank you, you understood the question perfectly. Yes, it's standardization I'm looking for, and if I mixed different topics, it's because different LLMs gave me different answers to the same question. And when I visited the Go website and realized I was completely lost, I said, "Okay, let's go to Reddit." And this experiment turned out to be quite interesting; I got different answers, with yours being the most extensive. And yes, it's as you say, and I've been able to confirm it with everyone: the closest thing to standardization would be "the language specification," but as you yourself said in this thread, it's very informal. And really, in the end, it's Google that dictates how the language works, or at least it should, since we all know that being open source, the final word rests with them. They are the ones who really decide how the language will be handled, in a silent agreement where very, very, very, very slowly they will add more and more things. I appreciate the time you've dedicated to me here. I'll keep reading the threads to see what else comes up. It's really interesting how one question can generate so much conversation. Thanks again.

3

u/Vizeroth1 5d ago

The very notion of standardization is that control of the language (or whatever you’re standardizing) is turned over to a standards body. From your statements, it appears that this has not been done for Go, so the answer is that there is no standard, there is only whatever Google decides Go is. This isn’t particularly unusual in the history of programming languages.

The specification/implementation from the original developer of the language is often called the de facto standard because no formal standard exists. Another example of this would be Java. The lack of a standard in that case lead to lawsuits between Sun and Microsoft over the Java trademark (which lead to a settlement and Microsoft no longer shipping a Java runtime in their products) and between Google and Oracle over the use of the Java language and APIs in Android, which went to the Supreme Court, ruling in Google’s favor.

1

u/MousseNo1453 5d ago

Wow, the Java example is crazy, I didn't know about those lawsuits. So, to be strictly accurate, I should write that Go has NO formal standard, and that the Go Language Specification (plus Google's implementation) acts as the 'de facto standard'? Does this lack of a formal standard give Google too much power over the language, or is the open-source nature of Go enough to balance it out? Thanks for the history lesson!

2

u/Vizeroth1 5d ago

I’m not familiar enough with Go and its history to really have an informed opinion on whether the lack of standardization is harmful. Neither open source implementations nor formal standards completely prevent a company from abusing the patent and copyright systems.

For instance, Microsoft submitted C# and the Common Language Infrastructure as ECMA standards, but they were just coming out of an Antitrust lawsuit and were very vocally anti-GPL so many people were very hesitant to attempt to implement the standards. I didn’t really keep up with how open those standards have been to proposals from outside Microsoft, but MS has dramatically changed their approach to the open source community.

1

u/MousseNo1453 5d ago

Thank you so much for the information. It's going to help me a lot. Furthermore, I must admit that I had never heard the term "de facto standard" before this thread, and I will certainly use it in my final response. Thank you so much for your time and help!

1

u/lurgi 5d ago

Like Rust and Python, there is a reference implementation.

2

u/ralphpotato 5d ago

This is actually strictly different than having a standard. Rust specifically is not standardized which gives them the freedom to make breaking changes. The only way to make a compatible Rust compiler right now would be to compare to the Rust compiler, not adhere to the standard.

1

u/MousseNo1453 5d ago

What would it be like in the case of the Go language?

1

u/ralphpotato 5d ago

I’m not an expert here but seems like golang publishes a specification that you could make an implementation against.

One difference is that it moves much faster than C/C++ which each only publish a spec/standard every few years. In the case of C, there was one roughly in 89, 99, 2011, 2017, 2023, whereas go keeps doing minor revisions every few months.

1

u/MousseNo1453 5d ago

That's a really good comparison. So Go's 'proprietary specification' acts more like a living document that evolves every few months with minor releases. Does this rapid update cycle make Go easier to implement for third parties, or does it make it harder to keep up compared to the slow, formal C standards?

1

u/ralphpotato 5d ago

My guess is that it would be quicker to implement a conforming go compiler than C- it usually takes many years for GCC and LLVM to implement the entirety of a new standard, and part of that is GCC and LLVM are enormous projects that also implement compilers for other languages and many more platforms.

1

u/MousseNo1453 5d ago

Which one is considered the official reference implementation for Go? And for my assignment, does this mean that the reference implementation acts as the actual standard, or is it still secondary to the written Language Specification?

1

u/lurgi 5d ago

“Which one”? There is only one standard implementation of the language as far as I know.

1

u/MousseNo1453 5d ago

Understood, that makes sense. I'll keep the main focus of my assignment on the Go Language Specification, which acts as the de facto standard for normalization. Thanks for the clarification! Or, do you think there's an alternative to this answer?