Live data from Hacker News

GopherCon 2014 Videos

confreaks.com

61–70 of 75 posts

Re: GopherCon 2014 Videos

#61
post #60

So, in the keynote, Rob underlines again that there'll be no generics. Ever. Path to getting generics thus becomes: 1. A preprocessor that eats ggo (generic go) files and emits go. This is is like the original C++ which translated to C for compilation. 2. Someone integrates ggo into go to speed it all up.

In one of the talks (I believe Q/A), he said "Go does have generics, they are called interfaces".

This is a point that folks new to Go often miss. I oftentimes see people compare "interface{}" to "Object" in Java, which is not true.

(If you don't believe me, note that not everything in Java is actually an Object - since there are multiple typekinds[0], that means that not every type can be used where Java expects to see an Object). That is part of the reason for the mess surrounding the so-called wrapper types like Integer (which are themselves neither objects (wrappers are passed by value, not reference) nor primitives (they are in most[1] cases unboxed to primitives, but are not themselves the same things as primitives).

Aside from the fact that Java didn't add generics until 1.5 (if I remember correctly), which certainly didn't stop its popularity, it cannot be emphasized enough that the need for generics is dramatically reduced if one actually understands how to use interfaces idiomatically in Go and understands how they are different from "interfaces" in Java or other languages[2].

While I occasionally run into a situation in which Java-like generics would make things marginally easier, they're few and far between; interfaces bridge far more of the difference than non-Go programmers often realize. And has has been explained to death already (both at Gophercon and on the mailing list) - generics are not out of the question for a hypothetical Go 2, but there are going to be no more changes to the language syntax for Go 1.

[0] I counted either 5 or 6 at one point when I was using Java heavily in university, but that was several years ago so don't quote me on that exact number.

[1] emphasis on "most" - there are some very "fun" edge cases that you can find here!

[2] I'm reminded of how Haskell has both "class" and "return" as keywords that have nothing to do with their Java counterparts - I think Go's "interface" is along the same lines - it's the same identifier/term, but a very different meaning.

Re: GopherCon 2014 Videos

#62
post #60

Earlier quoted context omitted.

In one of the talks (I believe Q/A), he said "Go does have generics, they are called interfaces".

This is a point that folks new to Go often miss. I oftentimes see people compare "interface{}" to "Object" in Java, which is not true. (If you don't believe me, note that not everything in Java is actually an Object - since there are multiple typekinds[0], that means that not every type can be used where Java expects to see an Object). That is part of the reason for the mess surrounding the so-called wrapper types li…

> This is a point that folks new to Go often miss.

It's still not true that interfaces are generics, though.

> Aside from the fact that Java didn't add generics until 1.5 (if I remember correctly)

But that was a big mistake in Java: they had to implement them using type erasure and primitives didn't work with them (due to backwards compatibility), and they had to duplicate the collections library to have non-generic and generic collections (again due to backwards compatibility).

> [2] I'm reminded of how Haskell has both "class" and "return" as keywords that have nothing to do with their Java counterparts - I think Go's "interface" is along the same lines - it's the same identifier/term, but a very different meaning.

I don't think the difference is that stark—interfaces in Java and interfaces in Go are essentially the same thing. The facts that all values can be wrapped in an interface (which is also true for C#, I believe) and that interface matching is structural instead of nominal are relatively minor.

Re: GopherCon 2014 Videos

#63

Earlier quoted context omitted.

> The joke about the profound error of using whitespace just shows how partisan these discussions are. In go, with the semi-colon insertion rules and with gofmt, there is an implicit whitespace rule all over again. Other than lisps, most languages have significant whitespace -- treating, for instance, newlines as having an important distinctions from other whitespace.

> In go, with the semi-colon insertion rules and with gofmt, there is an implicit whitespace rule all over again. So this is technically correct (and I had never though about that before, so thank you for pointing that out!). However, I think '\n' and '\r' are not directly comparable to '\t' and ' ' characters. All whitespace is only visible by its boundaries (kinda like certain 70s minimalist sculpture, actually). N…

> However, we don't read text vertically, we read it horizontally (I know there are exceptions, but not in any significant programming languages that I know of).

I think we do read code vertically and it is significant in all programming languages, and I think that it is a core problem with acceptance of Lisps, because they unusually strongly avoid leveraging the two-dimensional nature of typical code editing environments in favor of having pretty much the perfect purely-horizontal syntax.

> So I would say that while both cases have the problem that we can only observe whitespace by the characters that surround them, in the vertical whitespace that happens at a coarser, less ambiguous level than horizontal whitespace.

I do think there is an ambiguity difference, but its not because we read horizontally but not vertically, but because horizontal whitespace in common use -- i.e., that people are used to using on a keyboard in the context of programming -- is limited to newlines (and, while there are different means of expressing newlines, they are mostly driven by platform rather than personal preference and are, in any case, easy to account for), whereas tab/space holy wars are as old as line oriented PLs that allow indentation (whether they are sensitive to it or not).

Re: GopherCon 2014 Videos

#64
post #3

I am watching the keynote, it looks interesting. I don't know Go at all, though I know several languages including C. I don't quite know what he is talking about when he talks about main and initialization. Can anyone elaborate on this for me? I hate to say this because I feel like a jerk in doing so, but I'm about 25 minutes in and the little gopher that scrolls across the screen (some sort of advertisement, I think…

The gophers are being removed by popular demand.

Re: GopherCon 2014 Videos

#65
post #59

Earlier quoted context omitted.

> I am on the side for proper dependency management. Vendoring is one of several proper dependency management options. It's also the option most suited to the Go ecosystem at this time.

Responses to dependency management and generics from Go supporters always sound like la-la-la hands-in-the-ears denial to me. "X? We don't need no stinkin' X".

It's true: not all features yield net benefit.

Re: GopherCon 2014 Videos

#66
post #3

I am watching the keynote, it looks interesting. I don't know Go at all, though I know several languages including C. I don't quite know what he is talking about when he talks about main and initialization. Can anyone elaborate on this for me? I hate to say this because I feel like a jerk in doing so, but I'm about 25 minutes in and the little gopher that scrolls across the screen (some sort of advertisement, I think…

The gophers are being removed by popular demand.

Nice!

Re: GopherCon 2014 Videos

#67

Earlier quoted context omitted.

> In go, with the semi-colon insertion rules and with gofmt, there is an implicit whitespace rule all over again. So this is technically correct (and I had never though about that before, so thank you for pointing that out!). However, I think '\n' and '\r' are not directly comparable to '\t' and ' ' characters. All whitespace is only visible by its boundaries (kinda like certain 70s minimalist sculpture, actually). N…

> However, we don't read text vertically, we read it horizontally (I know there are exceptions, but not in any significant programming languages that I know of). I think we do read code vertically and it is significant in all programming languages, and I think that it is a core problem with acceptance of Lisps, because they unusually strongly avoid leveraging the two-dimensional nature of typical code editing environ…

> I think we do read code vertically and it is significant in all programming languages

Of course it is significant, I was agreeing with you there! But my point was:

d

o

_

y

o

u

_

e

v

e

r

_

w

r

i

t

e

_

c

o

d

e

_

l

i

k

e

_

t

h

i

s

?

But maybe I should have worded it differently: we read text in "row-major order", not "column-major order". That's basically the difference I talk about.

Also, there is another difference between newlines and indentation: newlines only go "forward" (next line), whereas with indentation you go back and forth into levels of indentation. It's not the same. The closest thing I can think of is that one language where you could write the exponent of a formula on a line before, faking superscript, or the index of a formula on the next, faking subscript. Making mono-typed source code look like math formulas basically (and probably a pain to type out). That's the only programming context I can think of where newlines are actually significant in a similar fashion to indentation.

Re: GopherCon 2014 Videos

#68
post #53
post #51

Earlier quoted context omitted.

Lots of apps are better with C, not just with regards to latency sensitivity (e.g games). E.g an app that would process a multimedia file offline (so latency is of no concern) still runs circles around most other languages if its done i C or C++. And of course 90% or something of desktop apps are written in C/C++. People act as all those apps, which is what we use everyday, don't exist: browsers, editors, media playe…

Object Pascal, Ada, Modula-2,...

Sure, I don't disagree with those (and Fortran, Obj-C, up to Rust someday).

Just wanted to highlight that most desktop programs people use by the millions are in fact written in C/C++ (statistically) -- and it's not all about GC, web programming and services.

Re: GopherCon 2014 Videos

#69
post #42

Earlier quoted context omitted.

Newlines are important, but that's true of pretty much every language. Go does have more stringent requirements on where open braces are placed, but it's not a hard rule to remember (they always go on the same line as the code that opens the new scope). Also, this rule makes your code significantly less prone to breakage from errant edits and merges, since inserting a line can never separate your brace from the line…

I think the way Go treats coding styles is great. I don't have any problems following a one true convention enforced by the language and being aware about the minute details of code structuring in order to avoid problems in translation. Funnily, the language that taught me all that was Python. As willvarfar points out, I feel Rob Pike is being disingenous when he talks about this. Golang uses less significant whitesp…

This seems like a logical fallacy. Of course you have to separate your language's tokens with something. This is not "significant" whitespace. It's token delimiters, and they don't generally need whitespace. for example func(){return 1} has no whitespace between func and the open paren, also

    func        (){     
            a := 1
                          return a

             }
while ugly, this still compiles just fine. It would compile just as fine if you randomly flipped some of the spaces into tabs.

Whitespace is not significant in Go.

The difference between significant whitespace and requiring "some" whitespace is that if you did something like that in Python, you could end up with a program with different logic depending on which spaces were flipped to tabs. This is why mixing spaces and tabs in Python is verboten.

In go, you can mix spaces and tabs all you want, wherever you want in your code and it will never ever change the logic of your code, period. (obvious exceptions for changes inside string literals)

So, it's not really a matter of degrees, and Python's method is completely broken if you ever mix tabs and spaces, which as Rob Pike points out, are completely indistinguishable in the default views of most editors.

Re: GopherCon 2014 Videos

#70
post #59

Earlier quoted context omitted.

Responses to dependency management and generics from Go supporters always sound like la-la-la hands-in-the-ears denial to me. "X? We don't need no stinkin' X".

It's true: not all features yield net benefit.

My car doesn't have a blender, a mini-fridge, or a hot tub. Some cars do. I don't think my car is worse off because of their lack.

Along the same lines, my mother used to always buy cars that were manual transmission and without power windows or locks, because they were features which made the car cost more, broke often, and were expensive to fix. The minor conveniences they afforded were not worth the costs.

Post reply on HN