Go carefully touts how few reserved keywords it has, but I think it would actually be a simpler to reason about language if it had more reserved keywords.
For example, you may notice that "true", "false", "len", "new", etc all aren't reserved keywords.
This sometimes does lead to bugs, for example someone may make a function, like "func memoize(new func(...interface{}) interface{}) func(...interface{}) interface{}", which shadows a common builtin function with a function argument.
Usually, the above leads to a compiler error when you try to use the "copy" argument (a value) as a function, but every once in a while, you end up with a type-compatible shadow, at which point things can really break.
It would be less confusing if things like "new", "len", "copy", and "true" were keywords, rather than builtins that someone may accidentally alias and shadow.
If you account for things like rather essential builtins as well, go's list of keywords starts to look far less impressive, and on-par with java or C#.
IF IF = THEN THEN THEN = ELSE ELSE ELSE = ENDIF ENDIF
...assuming IF, THEN, ELSE, and ENDIF are all variables.I'm kidding. It does seem like a strange decision...
that sounds like saying that latin-alphabet languages are easier to read than chinese or japanese because they have fewer characters. the complexity just goes in the way those characters are assembled together.
but that's because you come from a latin background. I lived with a japanese girl for a long time and she was adamant that kanji were much easier and faster to parse for her than western text
The question is if it's worth putting a 5+ year barrier in front of people in order to become fluent in a written language that maybe, possibly, might be "faster" once you are fluent. For native speakers, perhaps that's worth the effort (although there are plenty who argue otherwise). For second-language speakers, I think the answer is almost certainly no.
So bringing it back to Go. Perhaps Go seems more difficult and slow to people who already invested the years required to become fluent with something like C++. I doubt that, but I guess it's possible. But Go isn't designed for that case. It's designed as a second language that any programmer can learn quickly and become reasonably productive in.
If you have a company with 1000 programmers who all know different languages, and you want to start creating good software right now, would you standardize on the language that all 1000 programmers can learn in a couple of weeks, or the language that 100 programmers know inside out and the other 900 are going to spend a year figuring out?
You could make your same argument here and say "that's because she comes from a Japanese background" ;)
I'm mostly programming in C++ and I find understanding what happens in some Python scripts much harder than some template metaprograms I've worked on for instance.
If someone is already a C++ guru then writing something in C++ for them will be easier than learning Go. But that doesn't mean that Go is easier to learn than C++.
When talking about simplicity people generally compare all languages as if one has little or no familiarity with them. Otherwise it's not a fair comparison.
we're talking about humans, you cannot not conflate them.
> When talking about simplicity people generally compare all languages as if one has little or no familiarity with them.
that's a philosophically pointless exercice. Things have to be assessed in their actual, real-world context to bear any relevance !
One study I recall (on my phone now, will cite later) reported that fewer 20-year-olds have "fluent" levels of reading comprehension for what they read in the [ideographic] newspaper in Japan or China, than in neighbouring countries with alphabetic languages derived from those same historical ideographic roots (Korea, Vietnam, Thailand.)
Another study (will cite later) reported that the reading-comprehension rate for ideograph-heavy works in Japan is also decreasing over time, as more people spend their time reading mostly explicit "[ideograph-]light" novels, rather than literature that would actually teach them kanji. (Which is a vicious cycle.)
Given that ideograph radicals are kind of analogous to alphabetic morphemes, this is kind of surprising. I think it's mostly because it's self-evident how to pronounce alphabetic morphemes if you know the pronunciation rules of the language, while
1. the names for ideographic radicals need to be memorized, more like the names of alphabetic letters (but with there usually being far more radicals in common use per ideographic language, than there are letters in an average alphabet.) And
2. ideograms aren't usually linear, but rather structured (things above/below/beside things, things inside things, things bonded to other things and reduced in the process, etc); and there's no universal cultural fluency for speakers of these languages in an ordering system for spelling out these radicals. You usually have to see a character written before you can truly know how to "spell out" its radicals.
Because of these two problems, you can't just look at an ideograph you don't know, and casually, conversationally spell it out to someone else, in order to ask how it's pronounced / whether you're pronouncing it correctly. Unless, that is, you both know the names of all the involved radicals, and have a good geometric guess for the ordering. In practice, most people don't try to ask this question verbally, but either need to show someone the character written; or need to use a dictionary.
I've noticed that this actually results in distinct approaches to how people treat "literature with words they don't know", between people whose first language is an alphabetic one vs. people whose first language is an alphabetic one. Given an alphabetic-language work with word they don't know, alphabetic-native people seem to be much more confident in just jumping in and looking words up as they go; while ideographic-native people seem to be more reticent. I believe they're subconsciously expecting new [alphabetic] words to be a much larger barrier for them than they actually would be, as they're used to thinking in terms of the barrier that novel ideographs impose.
The World Bank puts China (97%) behind Korea (98%), but ahead of Vietnam (95%) and Thailand (94%). They don't have data on Japan, but I'd be surprised if their literacy rate were much lower. (I'm also on my phone, but here's the link: https://data.worldbank.org/indicator/SE.ADT.LITR.ZS?location... )
I think those literacy rates mostly reflect the quality of these countries' respective education systems, rather than any inherent properties of the scripts used.
This is a fair point since I wasn't very clear, and I am talking about something that's fairly subjective and abstract. I think the more claims a language makes, the more open it is to failure. I just googled is "rust difficult to learn", and the first answer is "no". It's all relative, but I am sure that most of us have heard that rust does have a steep learning curve. The only other language that I can think of that advertises itself as easy is python. And I think it has a lot of faults in those claims too. But python does a much better job of being easy than go does. It's completely different leagues.
Again, this is a messy point to make, either somebody understand what I am trying to say or they should leave it at that because trying to qualify ideas like this is fuitless.
> I completely disagree. Having fewer keywords does make Go simpler to learn and simpler to read other peoples code.
I really don't think skipping keywords like public and using casing makes things simpler. A quick google search shows that go has 6 less keywords than c. I mean, c'mon...
> I say this based on 30 years of experience writing software in more than a dozen different programming languages.
If you've had years of experience in old school c/cpp, then (I would assume) go will be a lot easier, and a lot better in comparison.
In my opinion old school C++ was a lot easier to learn than modern C++. I'm talking about the language specification specifically. The tooling is undoubtedly better.
Visual Basic 6 easily wins the "easiest language" award in my opinion though. But it's often seen as a faux pas to mention VB amongst developers
I partly disagree. It might be easier for you with 30 years of experience. Sysadmin with 8yrs of experience and having to manage operations utilizing Go is not easy.
The code looks neat on the page; under the hood is really un-understandable at times unlike Perl, Ruby, TCL where the code is staring you in the face. The importation of modules off github is fundamentally wrong too.
Are you able to elaborate on this a little more? I love Perl and in fact that was my favourite language for a long time (despite all of its warts). But languages like Go are a lot more explicit that Perl so I'm not really sure what you mean by "under the hood" and "code is staring you in the face.
> On vent: I also really loathe importing modules off github.
I must admit that really annoyed me too but in fairness it's a pretty common pattern (eg brew, npm, etc). In a way Perl (CPAN) is an edge case rather than the norm. The difference is other systems add a shim around the code source even if they do still pull directly from (or from a cache populated directly from) Github et al
We use Prometheus exporters, most of the exporters are written in Go. And this is a snip from the vmware-exporter for our VMware estate.
metrics.go
The first throw was this: import (
"context"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/view"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
So as it currently stands I have no idea what those modules are and what I am loading. Browsing each of those repos sure will tell me, but that's not my role. My role is to make X operational.And if that repo doesn't exist anymore and you go to compile, it fails. More overhead if I need to make changes to any of those modules. I would need to git clone it somewhere, make the change and then either recommit it to git, or do something to make it locally available. At least with NPM, CPAN they are local to the file system.
So lets start:
var (
prometheusHostPowerState = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: "host",
Name: "power_state",
Help: "poweredOn 1, poweredOff 2, standBy 3, other 0",
}, []string{"host_name"})
I understand all of that. Power_state, display the help, power status description etc, however prometheus.NewGaugeVec --
Sounds great. What is it? Where do I find this? What module is this related too?That's where it falls down for me. I now have to duck in to the rabbit hole of github to find out where that function is phrased and in this sense "under-the-hood" could also count for library .pm files in perl, but now having to navigate GitHub really messes with my workflow.
Take any of these imports, append it to https://godoc.org/, and see.
For example, github.com/vmware/govmomi/ becomes http://godoc.org/github.com/vmware/govmomi/ , which tells you:
govmovi: A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter).
Everything underneath govmovi is subpackages of it, so `find`, `view`, `vim25/mo`, and `vim25/types` are all govmovi packages. You can also visit them on godoc to read documentation, if the code authors followed documentation best practices.These are imports like in any other language. They are, however, nearly always based on a global URL, and thus have a godoc page that you can visit and read the docs for immediately. They are also always qualified, so if you wanna find all all uses of govmovi/vim25/mo, just C-f for "mo." in your codebase. No `from foo import *` equivalent exists in Go, which is one of my favourite features of this language.
But Go doesn't present you the code on disk. I have to hunt somewhere else with a reference. With a library file, I know that prometheus::exporter::blah is related to the perl module prometherus, exporter subroutine blah
I need the code in front of me to understand how it's interacting; the whole github ruins that for me.
Depending on whether you use gomodules, GOPATH, or any other build system you also can find the files locally to grep through them or use your text editor to read them locally. You can also override import resolution to point to a fork (eg. of any module if using gomodules), if you want to test drive some local patches.
I do a _ton_ of code reading in my work, and I find using Godoc for that probably the best experience of any language (second only to maybe Haskell/Hoogle, but there you get much more difficult-to-grok-at-a-glance code).
So much overhead where time is limited. I shouldn't need to fork packages, I don't want to fork.
Yes it does. You couldn't compile the modules if they weren't on disk :)
This is no different, to me, than downloading a tarball of Python software with requirements.txt and not running setup.py or pip install. I don't understand the problem.
Go isn't my thing and the less time I play with it, the happier I am. This is only my experience of it, and my experience is it acts friendly, but is a faff.
There lies the problem. If you don't want to invest the time to learn the tools then you can't really complain that your screwdriver is rubbish at hammering in nails. And it doesn't matter how easy or hard any programming language is, all languages will have a learning curve that people need to be prepared to undertake.
End of shift, I walk away from my screen and try to do something other than. I'm burnt out enough by the tech field as it is.
Sure knowledge is boss, but my job is fine. It's not the job at fault.
What are your expectations? Is it that every language should be readable to people who know Perl? Is it that you shouldn't be reading or modifying the source code of open source projects? How could this work better in an ideal world? I am puzzled.
When my job is 98.9% something else than programming, I'd rather be learning AI, Robotics, History, Psychics, Gardening, Glass Blowing than a language I'll never use.
I've explained it a case of "Can you get this to work" Yes/No. If no, I move on to something else. That's my line of work.
If you want me to monitor,configure,administrate something, then it should be simple. Presented to me in one folder with all packages not downloaded from some corporate hell-hole of a website because it's the norm for younger developers. Am I not allowed to have that opinion?
I will research on how to operate but that's it. Life's busy enough that I don't have time to further research on how to setup individual environments. I've just wasted 10 minutes typing this message to reply rather then configuring an openldap server for user authentication, Luckily I'm on lunch.
I'm just trying to understand that worldview, which just seems drastically different from mine, even though we both seem to be generalists. If there is something that Go, or any other product, could do better to be better suited to your workflow, I would like to know what it is.
I don't write Perl, but if I had to qualify some piece of software that used it at work, I would make time then to learn as much of the basics of it that is needed to more easily get by. Even if it meant a day of reading Perl/CPAN docs to do 15 minutes of actual 'work', especially if the alternative is one or two days of blindly stumbling around to then not even be exactly sure if my 'yes/no' answer was correct. I don't even see much of a difference between learning something and just working with it - I can't imagine not having a browser window open with the docs/source code/whatever of what I'm currently working with.
In that way I've learned a fair bit of technologies I would have never touched otherwise, but now their knowledge, even at a surface level, is worth more than the sum of the products.
TCL.
TCL is the only language workflow that has worked for without any stress.
proc SomeProcedure {variable} {
Code it to do something for yourself }
save, run and it works. No need to include modules, no need to download anything. I use my own TK/Gui interface which does stuff for me to make my life easier. And if I handed it to you, it would be in one folder with all files present no dependencies required. However I understand life is not like that unfortunately.> I can't imagine not having a browser window open with the docs/source code/whatever of what I'm currently working with.
I don't. If at any point I need source code, I'll download it locally and compile/run it first. Then edit it learn the logic and flow of the program. I'm in terminal 99% of the time, orchestrating systems ranging from FreeBSD to Linux and AIX, if a browser is open it's for Slack, emails.
I am someone who wants to type "man something" and get a man page of it. vim Library/file.pm and be able to view the code under the hood for that specific project. That's simplicity and that's how it should be -- The over-hassle of downloading from git, forking it, apply push,pull changes just isn't my street specially assuming my box I'm working with has internet.
Opinion: I don't enjoy Go as much as Perl. [PASS]
Opinion: I'm more comfortable with Perl because I've spent more time in it. [PASS]
Both are perfectly acceptable.
However you made comments about objective truths that were incorrect:
Truth: Go doesn't download modules to disk. [FAIL]
For what it's worth, I really like Perl too. Us two are a dying breed in that regard. I was in two minds whether to reply because of that respect I have for fellow Perl hackers. But you kept repeating the same falsehoods as fact :(
Take your latest comment for example, you can bring up the Go docs for packages in the terminal as well:
go doc $PACKAGE
So even there your Perl point is still equivalent to Go on an objective level. But I don't blame you for not liking/enjoying a language on a personal level.The main thing I was going on is "Here's a GitHub link, add it to your code and you have an instant logger thing". Magic in my eyes and this blinding light throws me off.
Unlike Perl where the code is in a .pm file in front of you. That was what I was trying portray.
I'm going to leave this discussion to rest as it's all went wrong anyway. Tomorrow will be tomorrow and this will all be forgotten in a day.
Thank you for your responses and have a good evening.
To be honest, I wonder if you're even using Perl correctly because if you're installing CPAN modules correctly then the .pm file is stashed away in an alternative directory that's looked up via an environmental variable -- just like with Go. The Perl module shouldn't be present in your projects workspace (and actually Go makes things easier than Perl here by allowing modules to be "vendored").
Go and Perl are very similar in a great many ways:
+ Both languages order modules/packages by directory hierarchies
+ Both languages look up module/package paths via special environmental variables
+ Both have CLI tooling to download and install modules/packages
+ Both have CLI tooling to read module/package documentation
+ Both are very much command line orientated
+ Both are imperative languages who's object systems feel like a half-arsed after thought and thus both really feel more at home writing functional code than OOP.
+ Both allow functions to return multiple parameters (a trait that's not too common outside of Perl and Go)
+ Both are strictly typed, support duck typing, and have a fairly limited type system.
+ Both treat arrays/slices and hash/maps as special types where the runtime has to have special code for handling them (ie you couldn't create a custom data type like a array/slice nor hash/map using Perl/Go's own standard library).
In fact the very reason I warmed to Go was because it felt like a nice hybrid between Perl and C. This was why I was so baffled when you said Go had some hidden behaviours under the hood when in fact managing a Go project is actually very similar to managing a Perl project.
You want a stagnant field. Sorry if I come across as too blunt, but you chose the wrong line of work if you don't like change. You'll still be able to work with the same old, boring but proven tech for the rest of your life, but face the fact that you'll be more inconvenienced by the reality you live in as time passes.
However when I have more pressing matters and when I am not requiring to use Go for my day to day life I have no purpose to put further education in to it other then enough to get by with.
Again, just like with Perl.
> I understand all of that. Power_state, display the help, power status description etc, but prometheus.NewGaugeVec -- great. What is it? Where do I find this?
It's a function in the module `prometheus`: "github.com/prometheus/client_golang/prometheus"
It's the same thing as the following Perl code:
use Prometheus;
use Prometheus::Log;
use Prometheus::Find;
use Prometheus::View;
use vmware::govmomi::vim25::mo;
use mware::govmomi::vim25::types;
my %prometheusHostPowerState
= prometheus::NewGaugeVec(prometheus->GaugeOpts{
"Namespace" => $namespace,
"Subsystem" => "host",
"Name" => "power_state",
"Help" => "poweredOn 1, poweredOff 2, standBy 3, other 0",
}, @("host_name");
As you can see the code is actually really similar between the two languages in that regard. Bare in mind I'm not suggesting that the languages themselves are similar, eg how modules are created, methods written and arrays are handled are clearly different. But the concept of reusable imported modules and properties in a struct/hash are ostensibly the same.Disclaimer: I've not written much Perl in the last 3 years so I might have gotten some of the syntax slightly wrong. But it should be close enough for demo purposes.
With the line above, prometheus::NewGaugeVec. I know it's related to the Prometheus module, NewGaurgeVec subroutine.
I'm not a programmer, I'm a systems admin who job is to take requests of such "we need a vmware exporter, I have this. Make it work".
I think you'd probably have enjoyed Go more in the "old" days when $GOPATH was required and all modules were downloaded into your $GOPATH as it was more explicit were modules were and in a way it felt a little more like Perl with the file system being a more prominent part of modules. This was a very unpopular pattern for developers so things have moved on somewhat with modules now being pulled into a package directory. Personally I preferred the $GOPATH days too but it's fair to say the modules are still on disk.
Your argument seems to be, "I don't like reading documentation." Then by all means don't and write your own prometheus metrics module shrug
I'm a sysadmin, not a programmer. So I don't code for business operations. I compile them to make them work. I don't have time to read all the schematics of the application to make it work, but when it comes to perl, or TCL for that matter. All files are local, if my box has air-gapped and no access to github. Then what?
> Your argument seems to be, "I don't like reading documentation."
Not at all. I have limited time to spare on documentation. It's easier for me to read the code in front in practical form then it is to read documentation written on some wiki.
Some projects still use this to ensure sources work airgapped as well.
https://golang.org/cmd/go/#hdr-Make_vendored_copy_of_depende...
Sounds like you have an organizational problem, not a programming language problem.
I would expect developers to provide you with an actual application or at least automated way to build it, and you to deploy and handle the given application.
Instead you have developers providing source code and you trying to understand how to make it work.
There are plenty of tools, methods and ways to get a repeatable build process, including docker, CI, bash scripts...
Even a README file can contain a valid and repeatable build process.
Even a process called 'ask to Robert how it works' would provide you with the information you need
It's hard to imagine that this is not scripted or at least documented somewhere.
This is one of the most famous straw man arguments made in software development and I've seen it used against a plethora of different programming languages -- each time completely missing the point that you can get bad developers writing bad code in any language. The fact it happens in Go isn't a testament not to how difficult it is but rather how good of a job the language has done attracting newer developers.
> Go is not a simple language. Please learn from my mistakes, and ignore arbitrary metrics like how go has fewer keywords. The complexity doesn't go away, it's hidden away somewhere.
I completely disagree. Having fewer keywords does make Go simpler to learn and simpler to read other peoples code. The opinionated nature of Go also makes it simpler to collaborate.
Writing software isn't simple but that complexity of turning ideas into code doesn't change significantly from one language to another (generally speaking). You still have to solve a problem using logic and functions. I find the harder problems with software development is collaboration (eg ensuring everyone is following the same coding styles) and reading back old code. Go makes those things easier than some -- not all but definitely some -- languages.
I say this based on 30 years of experience writing software in more than a dozen different programming languages.