11 ms·
It's Friday gents! No excuse to set aside Saturday and Sunday, you can easily go through these examples in two days and grok it. Go is that _slim_, and that's g
by sergiotapia 13y ago
It's Friday gents! No excuse to set aside Saturday and Sunday, you can easily go through these examples in two days and grok it. Go is that _slim_, and that's good!
Guaranteed you'll find use for Go in one system or the other when you want easy deployment, fast development time and extreme speeds. :)
(Disclaimer: I love Go and I hope it goes mainstream in a big way in 5 years)
- binarycrusader 13y agoI've learned enough 'Go' to write a small 3D framework in OpenGL, and after doing so, I have no desire to go back for most of my projects. Making go-routines map to OS-level threads is a pain. And as much as I hate to trot out this old chestnut, the lack of generics is also a real pain. I've gotten too used to having generic containers to go back, and the various hacks available just aren't worth it. I still can't believe Go doesn't have some of the "basic" data types that older languages do such as Python's set() objects and the various operators. That said, if was writing a small command-line utility for text manipulation or something else similar in scale that doesn't involve dealing with POSIX threading, I'd probably use it instead of Python, C, or C++.
- TylerE 13y agoYou might like nimrod. Similar performance characteristics (or better) than Go, with Generics and meta-programming. Library situation is a little iffy, but there are full SDL and OpenGL bindings.
- FG_Regulus 13y ago> Similar performance characteristics (or better) than Go. Nope. It's without a doubt 100% better. The GC is brilliant and realtime with deterministic properties. The community has outperformed C++ in ray tracers and games, Ada in text manipulation, etc. It's absolutely freaking blazing since it compiles to really tight C and takes advantage of the 50 years of C compiler research & design. > Library situation is a little iffy. Libraries are hardly iffy. Any C code be called, and most c++ code can be called very, very easily and with little boilerplate. The standard library has a huge pure section, and for almost everything else it has dozens of bindings to C libs. And there are plenty of existing libraries in the babel library manager, such as SFML.
- TylerE 13y agoYou're overselling it. While you can call C code, the interface is often not very Nimrod-y and it's not automatic, you have to declare prototypes, and there are absolutely holes in the stdlib - the lack of any arbitrary precision/bignums library for instance.
- joewalnes 13y agoAgreed. I've been programming Go for a while, and yet I still find this site invaluable. Because I context switch between many languages, I forget syntax a lot. Hmmmm... maybe I'm just getting old. Anyway, I find it much quicker to get the answer I need by looking at GoByExample, than by browsing the Go docs. Kudos to this site. It helped me build this: https://github.com/joewalnes/websocketd/ https://github.com/joewalnes/websocketd/
- jamesaguilar 13y agoOne nice thing these examples also do is make it really simple for detractors to point out what they don't like about it. My #1 gripe about go, for example, is this: https://gobyexample.com/sorting-by-functions https://gobyexample.com/sorting-by-functions In a few other languages: // C++ sort(vs.begin(), vs.end(), [](const string& l, const string& r) -> bool { return l.size() < r.size(); }); # Python vs.sort(key=lambda s: len(s)) When they fix this, Go might be the perfect language for me. Until then, I'm not touching it with a pole.
- L8D 13y agoYou do realize that go has lambda expressions (anonymous, in-line, functions) right?
- jamesaguilar 13y agoI do know this, but it is not sufficient to solve the problem we are discussing. (Or, to put the statement in the form of a question, how do you propose solving the problem using lambdas?)
- skybrian 13y agoYou could pass the length and two functions for lessThan and swap.
- shurcooL 13y agoThis article's for you. http://go.c800colon5.com/blog/2014/01/09/a-grumpy-guy-complains-about-complaining/ http://go.c800colon5.com/blog/2014/01/09/a-grumpy-guy-compla...
- jamesaguilar 13y agoSeems like he's set up quite a strawman of his opponents. He's made some very complicated and unfounded assumptions about people who criticize the language he likes.
- d23 13y agoI've started using Go on a personal project and this looks to be a great concise resource. Hopefully this'll give me some fuel to work on it this weekend!
- hdevalence 13y agoAre there any plans to add generics yet, or do I still have to write a bunch of extra boilerplate functions in order to sort a list?
- colin_mccabe 13y agoHi hdevlance, Generics actually have very little to do with sorting a list in Go. The example that the parent gave could be expressed in one line as "sort.Sort(sort.Reverse(sort.StringSlice(vs)));" No generics needed-- only composition. sort.Reverse is a wrapper interface which can be composed with any other sort.Interface to reverse it. It is typesafe, too-- there are no typecasts. There are cases where generics would allow us to avoid typecasts, but this is simply not one of them. In many cases, what you want can be expressed via composition of types, and often (in my opinion) in a clearer way than by using lambdas, continuations, and callbacks. I suggest learning a bit more about the language and keeping an open mind.
- hdevalence 13y agoIf you say so -- I'm just going off of the examples given in the Go documentation on how to sort lists. If that's not the "Go-ic" way to do it, perhaps the documentation should be updated. If it is the "Go-ic" way to do it, then I think that my point still holds. I also don't really have a lot of excitement about the prospect of solving problems by composing types in Go. For instance, to the best of my knowledge, Go does not have language support for sum types. It's not that I'd rather use continuations or callbacks -- I like powerful, expressive type systems to do, e.g., static enforcement of contracts -- it's just that I think that Go's type system isn't very expressive. You're right, perhaps I'm totally misinformed about the language, and that lurking below there really is a way to do clear and clean things with types in Go. But everything I've seen points in the opposite direction, so at this point, though I have an open mind, I'd need more evidence to change my view.
- colin_mccabe 13y agoThe example we were discussing was written by Mark McGranaghan, and is not part of the go documentation per se. I think it's a nice little tutorial, but please don't confuse it with "the Go documentation." Mark's point was that you can create an arbitrary wrapper type around another interface, so that the behaviors are composed. This is the most flexible way to do things. If there's already a wrapper type that does what you want, however, then you can simply use that. They are both examples of composition, and both "the Go-ic way to do it." Composition is often overlooked by people who are fixated on other ways of doing things, like inheritance or generics. But in many ways, it's cleaner, since composition allows you to link together many modules without peeking inside. It's funny that people have accepted the reality of dynamic languages, but can't seem to "get" the idea of statically typed language without generics. There isn't a troll comment in every Python article that it would be better with static typing. Type systems are a little bit like body armor-- development can be slower, but in exchanged you get a little more confidence in the program. People have accepted the idea of going naked, and the idea of medieval-style full plate armor, but the idea that you might want some type safety, but not go overboard often seems to fall on deaf ears.
- 0xdeadbeefbabe 13y agoAlthough no one seems to have this problem, golang (easier to google "golang" than "go") doesn't suffer from #ifndef guard problem which can make your large C++ app take hours to build http://talks.golang.org/2012/splash.slide#18 http://talks.golang.org/2012/splash.slide#18. I mean if it were written in go it wouldn't take hours to build, and it would be clear which includes you really need. But people with large C++ code bases are probably--hey they have plenty of time to port code to golang while their large source code compiles.
- pjmlp 13y agoAny language with module support has fast compile times. Turbo Pascal 5.5 was compiling 34,000 lines/minute in 1989 in MS-DOS systems! http://edn.embarcadero.com/article/20803 http://edn.embarcadero.com/article/20803 Compared with module based languages, C and C++ toolchains have been always slower.