Live data from Hacker News

Facebook Go Libraries

github.com

51–60 of 98 posts

Re: Facebook Go Libraries

#51
post #34

Earlier quoted context omitted.

While this is clearly the wrong decision, one has to applaud the Go team for building `go fmt` and thus putting and end to unproductive discussions about formatting. (Although it would have been nice if `go fmt` didn't change code semantics.)

Wait, why is it clearly the wrong decision? I think using tabs for indentation is great. I agree gofmt is amazing, and for any language I'd happily trade whatever my personal style is for consistency and and gofmt-like tool. Can gofmt really change semantics? I would assume that's a bug?

Can gofmt really change semantics? I would assume that's a bug?

It is definitely not supposed to change semantics. If you ever see an instance of that, then it is a big fat bug and should be reported to the developers ASAP.

I doubt you'll see such a bug though. The language is designed to be easy for a computer to parse.

Re: Facebook Go Libraries

#52

Earlier quoted context omitted.

We are talking about computer semantics which exist in a discretized world, not english language semantics. By your logic, the word integer would be any number not a fraction or decimal down to negative infinity up unto positive infinity. There is no concept of infinity on a computer. Anyways, that's besides the point, and I think you missed the meaning behind my comment. The reason why a tab space cannot semanticall…

> There is no concept of infinity on a computer. Sure there is: http://en.wikipedia.org/wiki/IEEE_754-1985#Positive_and_nega...

Ok sorry. There is no true representation of infinity.

Re: Facebook Go Libraries

#53

Earlier quoted context omitted.

I'm relatively new to Go, and like you I wholeheartedly agree with the idea of solving formatting once and being done with it (and as an aside, I agree that tabs are the wrong decision). It was my impression that gofmt was essentially a pretty printer. Can you point to examples where it changes semantics?

go fmt will reorder your imports, which means that if there is an import ordering dependency, it will either be exposed (or hidden) by go fmt.

you should never have an import order dependency, since initialization order is unspecified.

Re: Facebook Go Libraries

#54
post #32

Is there any repo of Facebook D code? I thought they were making an investment in D. But this is a bit surprising because it seems possible that they use more Go than D.

This is not a lot of Go - it's mostly small contained packages for doing useful things. It was also written by the Parse team, who are the only people using Go at FB in production[0].

0: https://news.ycombinator.com/item?id=8601850

Re: Facebook Go Libraries

#55
post #36

Earlier quoted context omitted.

I'm relatively new to Go, and like you I wholeheartedly agree with the idea of solving formatting once and being done with it (and as an aside, I agree that tabs are the wrong decision). It was my impression that gofmt was essentially a pretty printer. Can you point to examples where it changes semantics?

It does not change semantics. If it does in some case, that's a bug and please report it. Edit: I see, import order can affect the order that the init()s in different packages are invoked, presumably. I stand corrected. Edit 2: But that should not matter since the language doesn't specify any dependence on that.

no, the order is unspecified, so it shouldn't be relied upon. The only order enforced is that imported packages are initialized before the package itself.

Re: Facebook Go Libraries

#56
post #47
post #33

I have no idea how to evaluate this, or even tell what it is. Could someone help me out? I see that it's a bunch of packages, under the heading of "Facebook Go". I assume this is something related to Google's Golang? I click on "tool" ("Go library that wraps the go tool"). This has a README that points to a documentation link. And that documentation says things like, "Build the Command and return the path to the bina…

The crappy documentation is very much in line with many Go libraries, sadly. There doesn't seem to be a great culture of documentation. People often just write bare API docs without explaining why the library is useful or showing a lot of examples.

It may be a cultural difference of system programmers (including Go designers and developers) and (consumer) application programmers (e.g., as in the Apple camp). System programmers regard themselves higher, prefer terse symbol names, specs, docs, mathematical expressions, and formal methods, don't seem fans of Objective C or Java style readability and verbosity. But then again, it's open source software -- No one owes anyone anything.

Re: Facebook Go Libraries

#57

Earlier quoted context omitted.

The Go team has made the decision that the language supports tabs for indentation, and it’s enforced by `go fmt`.

While this is clearly the wrong decision, one has to applaud the Go team for building `go fmt` and thus putting and end to unproductive discussions about formatting. (Although it would have been nice if `go fmt` didn't change code semantics.)

That's only if the developers use go fmt though. The only place I've worked at that used Go didn't use go fmt.

Re: Facebook Go Libraries

#58
post #2

OT but I think GitHub should show tabs as 4 columns. I find Go code is hard to read with all this whitespace.

No, it should show it as tabs, because that's what it is. Ideally, it should show it as 8 column tabs, as that is what gofmt assumes by default.

I don't think gofmt assumes any width for tabs. It, prints `\t` for indentation, and that's all.

Re: Facebook Go Libraries

#59
post #49
post #46

Earlier quoted context omitted.

Well, if you read the file you'd see that it's a grant of rights to use this software regardless of any patents Facebook has that may apply to said software. It looks to be more or less the same as the relevant clause in the Apache 2.0 license that says "you can use our patents but if you sue us your right to use this software is automatically revoked."

...and the Apache 2.0 license belongs to a short list of licenses that have been extensively reviewed and can be trusted. Every time someone comes up with a new license, the review work must be redone to ensure it respects the philosophy of Open Source. Which is why I prefer project published under well-known licenses (GPL2/3, LGPL, Apache, Mozilla, BSD, ...).

The package in question is licensed under BSD 3-clause license. I'm guessing the patent file is included as well to cover their bases.

Re: Facebook Go Libraries

#60
post #41

This is the first time I see a patent file in an open source project [1] and now I know I won't use this until my lawiers take a look at it. Sad world... [1] https://github.com/facebookgo/runcmd/blob/master/patents

Why is it sad? If you're big enough to have lawyers on the payroll, it doesn't take that much effort to have them take a look.

If you're not big enough, then it probably doesn't affect you anyway.

Post reply on HN