News for hackers. Stuff that matters.
Re:Leaving Go by stiff on Monday April 28, 2014 @01:43PM (#7661599)
There is something to your description. I use Go sometimes, for pragmatic reasons, when I need more performance than I can get from Python or Ruby, but boy is it a ugly language!

There are just tens of little ugly things Go does and the result is, well, even uglier. Writing four functions for every collection to be sorted, writing x = append(x, foo) everywhere, shitty namespacing that prevents you from writing list := list.New() and so on and so forth. Even C is more elegant, and I would probably prefer to use C, if only C came with a library manager like rubygems or go get and a decent repository of libraries. I would even prefer Java if it produced native binaries and had an integrated library manager.

Re:Leaving Go by tptacek on Monday April 28, 2014 @01:51PM (#7661662)
x = append(x, foo) is a common C idiom too; in fact, it's been awhile since I had to work with STL containers, but I think it was common there too.

I love Golang namespacing rules. They do exactly what I need them to do to allow me to call into other people's code using the right function calls, and nothing else. I think Golang's namespacing is a high point of the language.

Re:Leaving Go by pcwalton on Monday April 28, 2014 @01:53PM (#7661668)
> x = append(x, foo) is a common C idiom too; in fact, it's been awhile since I had to work with STL containers, but I think it was common there too.

No, vector::insert() is the common idiom and mutates in place. It'd be written `x.insert(x.end(), foo.begin(), foo.end());` For single elements, vector::push_back() is the common idiom, and also mutates in place.

Re:Leaving Go by tptacek on Monday April 28, 2014 @01:54PM (#7661677)
Hrm. I've written about 100kloc of C++ code, around ~1999-2000. I'm going to have to go figure out why I thought this was the case.
Re:Leaving Go by webkike on Monday April 28, 2014 @02:02PM (#7661743)
vector::insert() is certainly not a C idiom. In can never be a C idiom because that is C++ code. the x = append(x, foo) idiom can be seen all over C, most obviously with the use of realloc, which is often called to resize an array via x = realloc(x, newsize).
Re:Leaving Go by mjdwitt on Monday April 28, 2014 @02:18PM (#7661860)
Indeed. Which is why pcwalton is answering Thomas' conjecture about C++'s STL containers.
Re:Leaving Go by stiff on Monday April 28, 2014 @01:58PM (#7661706)
I don't think simply having a separate symbol table for packages and a separate one for types and variables would hurt much, and I hate writing things like aList := list.New(). Having said this, I know many of those things are purported to have such and such super important reasons, it doesn't change the ugly "feel" of the end result. Another instance is the indication of visibility by case, they will go on and on about how it's a triumph of simplicity, I think it's simply an ugly notation.
Re:Leaving Go by tptacek on Monday April 28, 2014 @02:13PM (#7661821)
I honestly am not sure I follow what your concern is with that line of code. list.New() looks extremely clean to me.
Re:Leaving Go by stiff on Monday April 28, 2014 @02:23PM (#7661900)
You frequently have packages that are named after generic nouns, like time, host, file etc. There are many contexts where this same generic name makes for the best variable name: clear, short, and easy to type:

  func ReadFile(filename String) {
    file := file.Open(filename)
  }
In Go you have to invent a new name, so invariably you will see a lot of:

  theFile := file.Open(filename)
  aFile := file.Open(filename)
  readFile := file.Open(filename)
depending on who wrote the code.
Re:Leaving Go by tomp on Monday April 28, 2014 @03:00PM (#7662127)
Unless you're also frustrated by not being able to write `int int = 3` in C/C++/C#/Java/most other languages, I don't see the point of your concern.

    f = file.open("a.txt")
    out_file = file.open("b.txt", file.WRITE)
Re:Leaving Go by pcwalton on Monday April 28, 2014 @03:12PM (#7662199)
You can write that in C though.

    typedef int foo;

    foo main() {
        foo foo = 0;
        return foo;
    }
Re:Leaving Go by tptacek on Monday April 28, 2014 @03:26PM (#7662290)
You can do the same thing in Golang by renaming the import that clashes with your preferred variable name. Nobody does it, though, because it's not worth the trouble.
Re:Leaving Go by Locke1689 on Monday April 28, 2014 @03:59PM (#7662538)
In the C# language we refer to this as the 'Color Color problem'. You have some enum or type Color and then a member of an object which you, quite obviously, want to name 'Color'. It's so annoying for the programmer to work around this that we define special exceptions in naming rules so the programmer can do what they want.
Re:Leaving Go by dvirsky on Monday April 28, 2014 @06:14PM (#7663477)
the only place where I constantly find this annoying is the url package. url := oh wait, shit, already imported that.

a couple of times I just changed the name of the import, as you sometimes do in Python:

import (

  urllib "net/url"
)

url := urllib.QueryEscape(...)

tada!

Re:Leaving Go by monkey26 on Monday April 28, 2014 @10:59PM (#7664658)
I've hit this a few times in Python and it bugged me like crazy. But then I grew up and dealt with it.
Re:Leaving Go by pjmlp on Monday April 28, 2014 @04:01PM (#7662555)
> I think Golang's namespacing is a high point of the language.

Really?!? Available in modular languages since Mesa days (mid 70's).