Where does this idiotic idea cames from that being "idiomatic" is some kind of virtue? Idiomatic Java was the FactoryProxySingleton EE-wank fest from Apache, SUN, Spring and co. It was by changing those idioms around (e.g. how the Play framework wrote Java), that saner alternatives emerged. The de-facto idiom of PHP before 2010 was messy code. It started getting more coherent after that, but the preffered idiom now (…
Stages of learning Go, with code examples
61–70 of 118 posts
Re: Stages of learning Go, with code examples
#62Earlier quoted context omitted.
The absence of generics makes it so that Go's composability is through copy/pasting your code while changing the types. There's even a tool to do the copy/pasting for you. Technically, it's composability, just not the best kind.
Generics and composability are orthogonal concepts, to me. I'm not really sure what sort of composability you're talking about. Can you provide an example for me to rip apart?
compose :: (b -> c) -> (a -> b) -> a -> c
?Re: Stages of learning Go, with code examples
#63Earlier quoted context omitted.
You really don't need a package manager for Go. Honestly, the main reason you need them for node, python, etc is because you're deploying source code to your production environment. You don't do that with Go. You deploy a binary, which has everything wrapped up in itself. Think of it as a self-contained virtualenv that requires zero effort on your part :) In Go, code is packaged via source control repos. If you want…
> You really don't need a package manager for Go. "You really don't need X for Go" is becoming the Go community catchphrase. And they're right: I won't need anything for Go because I wouldn't use a language whose community actively resists improvement. I could respect that Go doesn't have a package manager, generics, etc., if the Go community took more of a "if you want it, develop it" approach. But instead, the core…
There's no language you couldn't construct a similar argument for, is there? Except maybe Perl. There's always going to be some capability favored by some loud person who's going to publicly disqualify some language for not having that feature.
Weird that in this case it's an equivalent of npm or Rubygems, which are nice tools for beginners but a complete pain in the ass for serious projects; essentially, you're disqualifying Golang for not reinventing DLL Hell like everyone else.
Generics, I get. Package management?
Re: Stages of learning Go, with code examples
#64Just wondering, does Go finally has a package manager with proper versioning of modules? Edit: Somebody is heavily downvoting me on every reply, I would love to know why. I like Go and want to get into it since a few months but the missing package manager held me off. So what is wrong about my question?
We prefer to use version control, and vendor libraries in our project instead. This is language-agnostic, and allows us to have repeatable builds without extra tools. I've written up a tutorial about it using git-subtree: https://github.com/jamesgraves/example-go-app
Re: Stages of learning Go, with code examples
#65Re: Stages of learning Go, with code examples
#66Earlier quoted context omitted.
You probably were sarcastic, but in case you are not there's a brilliant article from Rob Pike about using and composing functions to create flexible APIs: http://commandcenter.blogspot.co.uk/2014/01/self-referential... There is countless proof about Go's composability through functions and interface, but I keep coming back to that one document.
> You probably were sarcastic I don't know that sarcastic is the correct word, but I certainly wasn't completely serious. Maybe "playfully antagonistic". I suppose the problem I have here is, if I was designing a language, and composability was a stated goal, then I wouldn't have come up with Go. > a brilliant article from Rob Pike about using and composing functions to create flexible APIs I'm sorry, but that API is…
I agree: not only does using it require a lot of boilerplate, but Option takes several arguments and returns a value that only restores the previous value of the last option! That sounds very error prone, I'm sure someone will think the value return by Option undoes all of the option setting.
Re: Stages of learning Go, with code examples
#67Earlier quoted context omitted.
Since I can fairly reliably type "mvn compile" to build five year old Java projects, I think it's fair to say that the Go community is in a dependency hell of their own making. Should every library author vendor their dependencies separately too?
I'm not in a dependency hell. I won't be if I add libraries, either, because there are tools for that. "Should every library author vendor their dependencies separately too?" Whatever it takes to produce your end-artifact should be under the control of the relevant organization. Again, let me emphasize, this has nothing to do with Go, and you violate it at your sole and singular peril. When the $PACKAGE site goes dow…
Re: Stages of learning Go, with code examples
#68Where does this idiotic idea cames from that being "idiomatic" is some kind of virtue? Idiomatic Java was the FactoryProxySingleton EE-wank fest from Apache, SUN, Spring and co. It was by changing those idioms around (e.g. how the Play framework wrote Java), that saner alternatives emerged. The de-facto idiom of PHP before 2010 was messy code. It started getting more coherent after that, but the preffered idiom now (…
That doesn't mean that idiomatic practices are always virtuous, but non-idiomatic code is only virtuous because it overcomes an inherent mismatch between what the user wants and what the language provides. With many languages (certainly js, java, c++) we see non-idiomatic practices guide changes to the language and then be replaced. Java gained functions to avoid the abuse of anonymous inner classes. ES6 is stealing from transpiled javascript languages left and right.
Making idiomatic code virtuous is the goal of creators and maintainers. Writing idiomatic code means that you have chosen languages, frameworks, and libraries that are closely aligned with the code you need to write and the style you want to write it in.
Re: Stages of learning Go, with code examples
#69Just wondering, does Go finally has a package manager with proper versioning of modules? Edit: Somebody is heavily downvoting me on every reply, I would love to know why. I like Go and want to get into it since a few months but the missing package manager held me off. So what is wrong about my question?
Re: Stages of learning Go, with code examples
#70If you want to fix the most broken parts of Go -- its ecosystem management tooling -- just replace your `go` command.
I have, and I love working on a project with a proper top-level src folder, with vendor-able packages discoverable in a top-level lib folder pinned to known-good commits.
There are literally dozens of go replacements, but the winning combination for me is using Goop [1], Makefiles, and symlinks to subvert `go get` and the naive way it parses import declarations [2].