Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active September 17, 2024 11:20
Show Gist options
  • Save sogaiu/b5a7af091cd454b602b996528012d76a to your computer and use it in GitHub Desktop.
Save sogaiu/b5a7af091cd454b602b996528012d76a to your computer and use it in GitHub Desktop.
golang notes

general

  • Go at Google: Language Design in the Service of Software Engineering
    • assertions without support
      • Go was designed to address the problems faced in software development at Google, which led to a language that is not a breakthrough research language but is nonetheless an excellent tool for engineering large software projects.
      • Or to rephrase, it is about language design in the service of software engineering.
      • Our answer to that is that the properties Go does have address the issues that make large-scale software development difficult.
      • A larger view of software engineering is required
      • The primary considerations for any language to succeed in this context are:
      • When launching a new language it is important that the target audience be able to learn it quickly
    • essentially same observation made in the 1990s:

      Some observers objected to Go's C-like block structure with braces, preferring the use of spaces for indentation, in the style of Python or Haskell. However, we have had extensive experience tracking down build and test failures caused by cross-language builds where a Python snippet embedded in another language, for instance through a SWIG invocation, is subtly and invisibly broken by a change in the indentation of the surrounding code. Our position is therefore that, although spaces for indentation is nice for small programs, it doesn't scale well, and the bigger and more heterogeneous the code base, the more trouble it can cause. It is better to forgo convenience for safety and dependability, so Go has brace-bounded blocks.

    • then why not just put underscores in front of the thing you want to suggest are not really meant for public use?

      Once we settled on using the case of the name, we soon realized it had become one of the most important properties about the language. The name is, after all, what clients of the package use; putting the visibility in the name rather than its type means that it's always clear when looking at an identifier whether it is part of the public API. After using Go for a while, it feels burdensome when going back to other languages that require looking up the declaration to discover this information.

  • Go is Google's language, not ours

dislike

misc

gofmt

  • by now difficult to find dissenting opinions due to selection bias?
  • My theory on why Go's gofmt has wound up being accepted
    • comments

      In just about every other language, scopes are coded with an edge-triggered signal. Python chose a level-triggered coding instead. That was a mistake, plain and simple. It means the programmer must maintain the signal on a line-by-line basis instead of a scope-by-scope basis.

  • Fmty Dmpty*
    • quoted (but not linked to):

      gofmt didnt take off. people complain constantly about it. the community hated that the code had to be formatted a certain way for the compiler to even accept the code. the go team forced it until the community just gave up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment