5 ms·
What I like about Go
- musicale 3y ago> static binaries Brian Kernighan just called to say that any well-designed libc should support static linking. And, for some reason, glibc does not.
- pjmlp 3y agoIt is incredible to watch how something that exists since compiled languages are a thing, is so appreciated as it was invented yesterday.
- 7moritz7 3y agoGreat summary, i like Go for these reasons too
- kramerger 3y agoThis blog post could have been written by me. This is exactly how I feel, on all accounts. Hope this doesn't mean we are in a cult ;)
- fatnoah 3y agoI'm new to Go within the past year or so. Every time I start thinking about some fancy sugar I got from another language, I've basically realized that I didn't need it. The ease of "build" and "run" is amazing to me, and when I find I need to do something fancy in my code, I generally find that I don't actually need that.
- wrcwill 3y agoquestion for experienced go devs: how do you deal with the lack of optional type or narrowing? from what i understand, pointers become used for that purpose instead (in addition to mutability). which then means that when you get a pointer you don’t know for what reason it is used, so you have to check it even if it was checked higher up in the callstack already. i wouldn’t actually mind the fact that you can forget to check for nil, i can accept a panic here and there, pretty simple to fix.. the issue i am finding is that it "pollutes" the code, since you end up doing the check more than once for the same value. if atleast you could only check once and then the compiler would know (ie optionals, or narrowing like TS). ideally you would dereference after the check, but you can’t because pointers are used for mutability AND optionals in other words, are there any tricks so that you only have to check once?
- janderland 3y agoCheck it once and type cast it before passing it down the call stack. If you need a polymorphic type all the way down then model it using structs and interfaces so that the required operations are always available as methods. It’s the same as other languages which lack optionals/narrowing: C/C++, Java, etc.
- leosanchez 3y agoC++ and Java both have some form of Optional btw.
- coldtea 3y agoYes, but in both it's not really mainstream.
- wrcwill 3y agosorry, type cast it to what? Say i have `*Thing`. Are you saying i should cast it to a `Thing`? That is what I was doing initially (im fine with copies), but then you can't call functions that mutate.
- liampulles 3y agoSoon after generics were introduced, I put a generic Maybe type in our team's codebase. Its been very helpful. Other than that though, I would say pointers are a last resort for indicating optional (I certainly do use them for this, but uncommonly). Idiomatic Go I think would suggest you use the empty value (I would use an empty value plus an // Optional comment). Using pointers in general is fairly uncommon in the Go code I write - I don't often need the mutability as you say, because I try to stick to pure functions. My thinking also, regardless of the language: be suspicious of a function that accepts an optional type. One should ask: is there a non short-circuit or non-error path in the empty case? If not, don't pass an optional, unwrap up the chain. Even if there is a valid path for an empty value, perhaps ask if the function should be split into two cleaner functions.
- coldtea 3y ago
- AtlasBarfed 3y agoComplete headline: What I like about Go as a former python programmer So ... I'd care more about the uh insights in this article if he has programmed in more than two languages.
- coldtea 3y agoI'd rather have the insights of someone who programmed in one language, than someone who dabbled in 200.
- Alifatisk 3y agoI agree, it seems common for people to learn "Hello, world" in 200 languages rather than diving deeper into one. I also understand why this happens, it's exciting and new, but I think the latter is more beneficial.
- AtlasBarfed 3y agoHow about good experience in about 5? And took an undergrad Programming Languages class? Going from Python (and not a comp sci background it appears superficially) to GoLang isn't some broad journey of deep insight into programming languages, not just from the Lisp zealotry, but to know the practical advantages of things at enterprise scale.
- Alifatisk 3y ago> Go is a pretty low-level programming language Has the line between low-level and high-level languages moved? I remember being taught that a low-level language is like Assembly language while a higher level is C. And I still stick to that, but is that not the consensus anymore? Also, why do we talk about static binaries like it's a new feature? Is it really that exotic nowadays?
- nerdix 3y agoThe line has definitely moved but not so far that Go would be considered low level. I think most people would consider languages without any sort of garbage collection to be "low level" now so C, C++, Rust, etc. Go used to (still?) market itself as a "systems programming language" and I think that along with the presence of pointer syntax gives some the initial impression that Go is a scary low level language. In fairness to the author of this article, he did call it low level as a comparison to Python and mentioned that it not as low level as C which is all true.