3 ms·
I love these release notes but I really wish they would add syntax highlighting to the Go blog. I'm always a little bit surprised/disappointed whenever I land o
by xavdid 2mo ago
I love these release notes but I really wish they would add syntax highlighting to the Go blog. I'm always a little bit surprised/disappointed whenever I land on a go.dev link since I know the code will be just a little harder to visually parse than it needs to be.
- treyd 2mo agoThere's a reason for this. Rob Pike was asked about it and said that syntax highlighting reminds him of the bright colors of children's toys and he personally disables it so that he can focus on the text. I don't know why it's still like that but that's the original reasoning.
- jeremyjh 2mo agoWhat is childish is holding up one guy's editor preferences as a religious sacrament when 99.9% of your readers have different preferences.
- dotwaffle 2mo agoWell, there's kind of a precedent at least... > Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.
- saturn_vk 2mo agoThat's been a major success
- XorNot 1mo agoIt basically revolutionized the entire industry and thank god. Opinionated standard formatting is now the default.
- poncho_romero 1mo agoUnlike formatting preferences, the colours I use in my editor don't effect others. That said I might not mind living in a world where everyone used the same highlighting scheme, as long as it was reasonable ;)
- tester457 2mo ago> Syntax highlighting is juvenile. When I was a child, I was taught arithmetic using colored rods (http://en.wikipedia.org/wiki/Cuisenaire_rods http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I use monochromatic numerals. https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/kG3BHV6QFfIJ https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/kG3B...
- IshKebab 2mo agoThat must be why traffic lights and electrical wires and transit maps are all black and white...
- abtinf 2mo agoThat’s an interesting point. The reason traffic lights are colored is because they are showing distinct states of the same thing and the color is the means of differentiating. Same for transit maps: different routes are colored to distinguish them from other routes, which is especially useful if they overlap. But that’s not what syntax highlighting does. The equivalent of your examples would be to not highlight the syntax at all, but only use color coding to distinguish variables. The equivalent of how syntax highlighting currently works for your examples would be if the light fixture was one color, and the light pole was another, but then all the actual lights were the same color. I actually think highlighting only the variables with distinct colors could be extremely valuable. Would certainly help avoid mistakes with nested i/j loop counters. Edit to add: come to think of it, it would have been even more valuable in Go, until recently anyway. The variable color coding would expose the common loop variable instance bugs, because a programmer would be instantly puzzled by the unexpected coloring.
- IshKebab 2mo agoThat does exist, it's called semantic highlighting. In any case, my analogy was not perfect, but neither was Russ's! The point is it's totally normal and not "childish" to use colours to help distinguish things. Traffic lights do not technically need colours (you can use the position of the lights - I assume that's what badly colourblind people do). Nor do transit maps technically need colours - you could just label the lines, or use patterns. https://www.flickr.com/photos/gywst/1407078279 https://www.flickr.com/photos/gywst/1407078279 It's completely absurd to say that colours are childish because they can help children.
- xavdid 2mo agoThat makes sense as a personal preference for him, but it's odd for that to still be the company/project stance. Like, surely he knows he's the minority for not wanting highlighting?
- jeremyjh 2mo agoOceania had always been at war with Eastasia.
- tgv 2mo agoApart from the fact that your comment is against the rules: please don't trivialize that quote. It has a profound meaning, and is completely out of place here.
- jeremyjh 1mo agoThere is a thread linked where we literally see gophers express the belief that they do not like syntax highlighting, and mock those who do - because Great Leader - born in 1956 - does not like syntax highlighting. Its called double think. https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/6STjtdoa0uIJ https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/6STj...
- mparnisari 2mo agothat's an extremely odd explanation and it makes me think that he has some hidden PTSD. it's also insane that one person's preference trumps the rest of the world's.
- pigeonhole123 2mo agoHe also doesn't capitalize his sentences.
- zanderwohl 2mo agoWelcome to Go as a project.
- tayo42 2mo agoChild hood trauma led to if err != nil and now the rest of us get to share that trauma? Makes slight sense I guess.
- deleted 2mo ago[deleted]
- catlifeonmars 2mo agoBorn out of C++ trauma apparently, for context
- parsd 2mo agoI understand and respect this position. I think syntax highlighting is a highly subjective matter, bordering on personal preference with regard to shell interactions, editor configurations, bindings, shortcuts, snippets, and the like. It's also... insignificant somehow, like quibbles over formatting rules that Go settled once and for all with `go fmt`. I often prefer not to enable syntax highlighting just for color. Occasionally I'd choose some minimal theme that only highlights string literals and keywords. So it has two or three colors. But some of the color schemes I see are a festival of lights where every special element of syntax has its own color. I don't understand how that is supposed to help me parse anything and why the rules are complex. The `range` keyword needs to be purple, and `chan` must be navy blue. Why exactly? And every site has a different color scheme? There is no consensus, and there shouldn't be. For a serious community-driven project like Go, dealing with the question of syntax highlighting is strange. The creators deliberately avoided the questions of IDEs and editors for Go, leaving them to the community. I think the same principle applies here.
- catlifeonmars 2mo ago> The creators deliberately avoided the questions of IDEs and editors for Go, leaving them to the community. I think the same principle applies here. Exactly. This is fundamentally about accessibility (in the broadest sense). Do people have opinionated screenreader settings they like to force on others too?
- ClikeX 2mo agoI just have a tampermonkey profile for go.dev to fix that for me.
- theplumber 2mo agoWhen I started learning Go I went all in including using the recommended editor (acme editor) which has no syntax highlighting, no autocomplete and a very different way of writing code. My production went down a lot but the quality of the code went up a lot. I think the lack of syntax highlighting was one reason for that. It makes you think more about the code you write and how it should compose, while a fully fledged IDE encourages you to just throw more code at the problem. I think the ACME way should be used for love of code and ideally when you want to create libraries that stand the test of time. When you just want to get things done fast bring the full IDE and now some LLM vibes and it’s done.
- dolmen 2mo agoAre you using the Go fonts? https://go.dev/blog/go-fonts https://go.dev/blog/go-fonts
- catlifeonmars 2mo agoI go through intervals of turning autocomplete on and off. I think autocomplete is useful for boilerplate (similarly LLMs are useful for boilerplate), but I prefer not to use either when writing code where correctness is particularly important. This is because it’s easier for me to internalize what something is doing by typing it out. It’s actually more effort for me to understand code by reading it rather than writing it. I experience something similar with system design, where the act of creating a diagram helps me to understand much faster than trying to read someone else’s diagram. It’s not because only I can create good diagrams (I cannot) but again because the act of creating one helps me internalize the design.
- Cthulhu_ 1mo agoI think there's a lot of value to be gained from turning all modern day features off for once and just code "raw", no syntax highlighting, just typing out all the code. Doesn't even need to be your own code, manually transfering code over can also help a lot with your basic coding skills. I think a lot of people lose this over time because it's easier to use templates, autocomplete and LLMs, work from a higher level. But it's nice to go back to basics. Consider also firing up Pico-8 and writing some really really bad code. It's got a very rudimentary editor, 40 columns of code, no syntax highlighting, and you're limited in how much total code you can write. It also helps with leetcode since a lot of leetcode uses game coding tricks like modulo operators, min/max/clamp, etc (that's as far as I got, don't judge).
- dolmen 2mo agoThe Go official web site doesn't even use the Go fonts: https://go.dev/blog/go-fonts https://go.dev/blog/go-fonts I wonder if the Go fonts has been created just to get a trademark on the "Go" word...
- amiga386 2mo agoThe Go language is by itself more than enough to get a trademark. They only additional thing you can do with a font is get a design patent... for the font. It's more likely that they don't feel the need to use the font they gave you (for your code editor) on code samples on their own web pages. As it's a custom font, the text would be susceptible to pop-in, or would visibly switch from one font to another, both of which are ugly. Their CSS says this: #blog .Article[data-slug='/blog/go-fonts'] code { font-family: 'Go Mono', monospace; } #blog pre, #blog code { font-family: monospace; } So they have no specific font preference for code samples, they only show their Go-specific font on the blog post about it. They prefer fast loading and no jank over custom font. EDIT: just force reload https://go.dev/blog/go-fonts https://go.dev/blog/go-fonts and look at the first hyperlink, "golang.org/x/exp/shiny". Watch it visibly switch from generic monospace font to Go Mono as the page loads. Janky! They probably don't want that for all their code samples ever.
- Cthulhu_ 2mo agoI get the why, kind of - if you need colors to make sense of code, maybe the code isn't clear enough. If you send blobs of code through email and other systems that don't necessarily have syntax highlighting, it also makes sense. But on a website, whyever not? Personally I can't say when I was last actually aware of syntax highlighting. The only time I'm actively engaged with it is to change the default low contrast comment color that a lot of themes have (for some reason, as if comments are unimportant / noise) to something better. For Go, I don't really notice when it has or doesn't have syntax highlighting, at least not on e.g. go's website.