3 ms·
And the most interesting thing to my mind is how little the subtle gotchas matter. The key is they're subtle. If a subtly-wrong design takes only 20% of the co
by shadowgovt 5y ago
And the most interesting thing to my mind is how little the subtle gotchas matter.
The key is they're subtle. If a subtly-wrong design takes only 20% of the code of the truly-correct design to express and understand and it works for 99% of the cases, then there's actually a benefit to a lot of users of using that architecture. If you end up in the swamp outside the happy path you can get badly burned, but that's the thing... If most people never see the swamp, the language's simpler approach can win.
To take an example from the article: the author correctly notes that Go's filesystem library may not be as portable as one wants it to be across OS's, and that it doesn't handle paths as byte-strings. The former issue is one many people don't see because they get to operate on a Linux monoculture (Go's wheel-house was web servers, which are often running on Linux). And the handling of file paths as byte strings is irrelevant if other tools in the Linux ecosystem can't handle them correctly either, i.e. "If it doesn't `ls`, it's not a real filename" is a reasonable position to take on that problem.
It sounds like the author lands in the swamp a lot or has some significant anxiety about ending up in the swamp, and a developer in that situation may very well benefit from using a language and library ecosystem that is more technically correct more of the time.
- jitl 5y agoI suspect the author deployed Go code to end-user windows desktop systems. I’m sure that would traumatize me. I deploy Electron/Node to Windows, but barely use the file system or any OS interaction and for that I am thankful.
- lliamander 5y agoI've only been doing Node for about a year now, and already I've been bit by gotchas. Obviously all languages have their warts, and I can compensate. Using Typescript with it, I've actually been quite productive. It's higher level of expressiveness relative to Java is also a breath of fresh air. But some languages definitely have more warts than others, and Javascript/Node is on the higher end of that distribution. All things being equal I would much rather work in a language with fewer warts.
- shadowgovt 5y agoOut of curiosity (if you're at liberty to say), what has bit you? I do Node / TypeScript basically all day these days, and I'm probably too close into the forest anymore; I'm wondering if other people are getting bitten by things that I just roll right past because I'm used to the pain. The extremely weak (and frankly incorrect) Date handling that's built into JavaScript is the first thing that comes to mind.
- lliamander 5y agoFair question, here's a few: - object methods cannot be passed as arguments to a function or another method like regular functions can because they lose their 'this' pointer. - array.sort() is broken. It does the sort in-place and converts the elements to strings before sorting. - const doesn't support separate declaration and assignment. This makes it harder to conditionally decide what to assign to a variable while still making it const. - number types. - the fact that you have to use '===' for the normal understanding of equality - Date handling could be better - NPM has a number of problems, including default behavior of updating your dependency versions.
- shadowgovt 5y agoThat's a good list, and I was right; I've been at this so long I've forgotten that most of those are 'WAT' to the average user. Regarding `object methods cannot be passed as arguments to a function or another method like regular functions can because they lose their 'this' pointer.`: yeah, the fact that JS objects are actually kinda weird li'l things is frustrating. There are nowadays two ways to handle that: - referencing the object in a closure binds the object instance. `(x) => foo.bar(x)` will do the right thing - there is an explicit bind operator, so you can do `myCallbackTaker(instance.myFunction.bind(instance))` ... but I agree that in a better language, you'd be expected to do neither of those things.
- lliamander 5y agoThanks for the tip about binding the object instance. Just to share an experience on the other end, I worked with Erlang several years back. While it was a harder language to learn, every new thing I learned about the language gave me the impression that the language designers did the right thing. Don't get me wrong, I'm having fun with my current Typescript/NodeJS stack at work, but if I was building my own stuff it would absolutely be on the Erlang VM.
- lpapez 5y agoThis is my take as well. From the article I can see why writing a library that works on anything and with anything would be hard in Golang, but I bet that's not what Golang is mostly used for. If I'm writing a millionth custom warehouse inventory app, I really don't care about hexadecimal filenames, I just want to ship it and get paid and Go is great for that.
- xg15 5y agoYou have no idea what the "swamp" is. What if it's some catastrophic data loss, an RCE vulnerability or causes an individual to be permanently locked out of an important account? Still don't care because 80/20?
- shadowgovt 5y agoYou've made an excellent point, and I think it's worth noting that half the companies that fail we never even hear the story of why. If we see a lot of companies succeeding using Go as critical infrastructure, that might be evidence that the swamp is rarely those things. If we don't... The swamp might be those things.