Live data from Hacker News

Official Go support

stripe.com

11–20 of 117 posts

Re: Official Go support

#11
Can someone explain?

I'm a big fan of C and python and I've never used Go. My initial impressions from readings were that Go is a better C. But then I came across a Go person who was lamenting that misunderstanding and that Go is python but with better performance. What's it all about?

Also even if we compare it to C I don't like the garbage-collection thing at system level. Also what does Go let you do in terms of garbage collection that cannot be done with a C gc library (which anyone can use if they want but then also have the choice to do raw/manual memory management if they want too).

Re: Official Go support

#12
post #3

Interestingly, it looks like the Go library uses structs rather than `map[string]interface{}`, even though the Java library was recently criticised for its usage of `Map `[0], a decision defended by the developer[1] on grounds that "[they] add new parameters to the API frequently, so it's a tradeoff to avoid devs needing to update stripe-java every time." [0] http://movingfulcrum.tumblr.com/post/97624791473/critique-…

(Stripe's Go library dev here)

There's a tradeoff space here, as that tweet indicates. Doing things generically makes the library less idiomatic, but means developers don't need to churn their library dependency as often. Go's a different language from Java, and it's less common to have to deal with casting, etc. As that tweet conversation indicates (particularly https://twitter.com/JimDanz/status/511732603884294145), we're also considering changing the Java library implementation in the future.

Re: Official Go support

#14
post #11

Can someone explain? I'm a big fan of C and python and I've never used Go. My initial impressions from readings were that Go is a better C. But then I came across a Go person who was lamenting that misunderstanding and that Go is python but with better performance. What's it all about? Also even if we compare it to C I don't like the garbage-collection thing at system level. Also what does Go let you do in terms of g…

The comparison to C has always struck me as strange. It has curly braces and pointers, but few semicolons, no pointer arithmetic, garbage collection, and tons of high level language primitives (maps, slices, channels, select, goroutines, a userland scheduler).

Many people, myself included, find it a wonderful language suitable for all sorts of service development whether it's data processing systems or web APIs.

Re: Official Go support

#15
post #3

Interestingly, it looks like the Go library uses structs rather than `map[string]interface{}`, even though the Java library was recently criticised for its usage of `Map `[0], a decision defended by the developer[1] on grounds that "[they] add new parameters to the API frequently, so it's a tradeoff to avoid devs needing to update stripe-java every time." [0] http://movingfulcrum.tumblr.com/post/97624791473/critique-…

Honestly parsing json as map[string]interface{}, rather than using a struct is a major pain in the butt.

I'm currently doing a project that takes json, with no predefined structure, or at least very varying struct and transforms it. Dealing with checking for keys and doing type conversion it's that much fun. The same project need to parse an XML file, with a clear and defined structure, it took something like five minutes and work on my first try.

I don't think you would need to update the Go library in the case of just adding new parameters, not if the parameter can be excluded. The json parser should just skip that value, it won't be available to you of cause, but it should break the parser. Given that I haven't touched Java in 10 years I don't know how Java deals with unexpected parameters.

Re: Official Go support

#16
post #11

Can someone explain? I'm a big fan of C and python and I've never used Go. My initial impressions from readings were that Go is a better C. But then I came across a Go person who was lamenting that misunderstanding and that Go is python but with better performance. What's it all about? Also even if we compare it to C I don't like the garbage-collection thing at system level. Also what does Go let you do in terms of g…

The comparison to C has always struck me as strange. It has curly braces and pointers, but few semicolons, no pointer arithmetic, garbage collection, and tons of high level language primitives (maps, slices, channels, select, goroutines, a userland scheduler). Many people, myself included, find it a wonderful language suitable for all sorts of service development whether it's data processing systems or web APIs.

I love Go and I consider it to be the spiritual successor to C, in a way (sort of an anti-C++, which the creators have said they used as an explicit example of what not to do).

Given that it was co-created by Ken Thompson (of Unix/C/Plan9 fame), I think the comparison is justified.

Re: Official Go support

#17
post #11

Can someone explain? I'm a big fan of C and python and I've never used Go. My initial impressions from readings were that Go is a better C. But then I came across a Go person who was lamenting that misunderstanding and that Go is python but with better performance. What's it all about? Also even if we compare it to C I don't like the garbage-collection thing at system level. Also what does Go let you do in terms of g…

Like any other language, there're some pros and cons with Go. For example, C gives you complete control at a very low level, but can make higher-order operations more complex. On the opposite end of the spectrum, Python removes a lot of that friction at the cost of doing more things behind the scene, which obviously affects performance. I regard Go as somewhat in-between -- it provides you with some of the lower level constructs (like pointers) but also reduces complexity (by giving you goroutines, for example).

Specifically about garbage collection, I'd recommend taking a look at what's coming up in 1.4:

https://docs.google.com/a/stripe.com/document/d/16Y4IsnNRCN4...

Re: Official Go support

#18
post #11

Can someone explain? I'm a big fan of C and python and I've never used Go. My initial impressions from readings were that Go is a better C. But then I came across a Go person who was lamenting that misunderstanding and that Go is python but with better performance. What's it all about? Also even if we compare it to C I don't like the garbage-collection thing at system level. Also what does Go let you do in terms of g…

The comparison to C has always struck me as strange. It has curly braces and pointers, but few semicolons, no pointer arithmetic, garbage collection, and tons of high level language primitives (maps, slices, channels, select, goroutines, a userland scheduler). Many people, myself included, find it a wonderful language suitable for all sorts of service development whether it's data processing systems or web APIs.

Another similarity is that both Go and C compile to dependency-free and portable binaries with no VM needed to run them. In my mind, that's the biggest similarity.

And regarding semicolons: you don't use them as much while coding, but the lexer puts them in for you, so they're there on some level.

Re: Official Go support

#19
post #11

Can someone explain? I'm a big fan of C and python and I've never used Go. My initial impressions from readings were that Go is a better C. But then I came across a Go person who was lamenting that misunderstanding and that Go is python but with better performance. What's it all about? Also even if we compare it to C I don't like the garbage-collection thing at system level. Also what does Go let you do in terms of g…

The comparison to C has always struck me as strange. It has curly braces and pointers, but few semicolons, no pointer arithmetic, garbage collection, and tons of high level language primitives (maps, slices, channels, select, goroutines, a userland scheduler). Many people, myself included, find it a wonderful language suitable for all sorts of service development whether it's data processing systems or web APIs.

I think the general idea is C++ (not C) in the style of Python.

You still have access to memory/pointers/unsafe, it shares a C-style syntax (go ahead, put in the semicolons if you want!), is compiled but offers the gentle, elegant watchfulness of a Python-like scripting language.

In most cases it can be a relatively drop-in replacement for C++ or Python as a binary. It will never be like C in that there's a lot of overhead and lack of memory control for embedded systems, so you probably can't treat it as a C competitor in any way.

Re: Official Go support

#20
post #3

Interestingly, it looks like the Go library uses structs rather than `map[string]interface{}`, even though the Java library was recently criticised for its usage of `Map `[0], a decision defended by the developer[1] on grounds that "[they] add new parameters to the API frequently, so it's a tradeoff to avoid devs needing to update stripe-java every time." [0] http://movingfulcrum.tumblr.com/post/97624791473/critique-…

Honestly parsing json as map[string]interface{}, rather than using a struct is a major pain in the butt. I'm currently doing a project that takes json, with no predefined structure, or at least very varying struct and transforms it. Dealing with checking for keys and doing type conversion it's that much fun. The same project need to parse an XML file, with a clear and defined structure, it took something like five mi…

Isn't this generally done anytime you don't know the structure of the json document that will be unmarshalled? If a new field is added and you're parsing to a struct that struct will have to be changed to accommodate that field, rather than letting it happen anonymously as through an interface.
Post reply on HN