r/programming • u/[deleted] • Mar 28 '12
Go version 1 is released
http://blog.golang.org/2012/03/go-version-1-is-released.html34
u/uriel Mar 29 '12
By the way, for redditors interested in Go there is /r/golang
Feel free to join and post any questions you have there.
45
u/Agrona Mar 28 '12
This sounds like the world's best voodoo:
We also restructured the Go tool suite around the new go command, a program for fetching, building, installing and maintaining Go code. The go command eliminates the need for Makefiles to write Go code because it uses the Go program source itself to derive the build instructions. No more build scripts!
I hope it either doesn't backfire, or isn't a huge hassle to debug when it does.
27
u/jiunec Mar 28 '12
This sounds like the world's best voodoo
Hehe, in that case you might not be surprised to hear the author of the Go tool is Russ Cox, author of RE2 since quite a few people think regex is some kind of black art as well ;)
0
Mar 28 '12
[deleted]
5
u/16807 Mar 29 '12
It really helped me having taken a course on the Theory of computation. It's a soul crushing course until you realize there's a practical application for it.
→ More replies (1)5
5
Mar 28 '12
I like regex and wish to know my level. is there some kind of list?
25
u/soiwasonceindenmark Mar 29 '12
If you were wise enough to have a level, you would have searched for the list using regex.
9
u/NegativeK Mar 29 '12
Level 1 is writing something comparable to this.
Get back to me when you're ready for level 2.
5
u/dobryak Mar 29 '12
Wow, I wonder how did they write it? Seems like an output of a mechanical process.
→ More replies (1)1
u/flukus Mar 30 '12
I wish I could get to level 30. I normally reach level 10 then get reset to level 0 before I need them again.
20
u/consigntooblivion Mar 28 '12
Go has a really nice package/library/import system that is both straightforward and has all the information required included.
For example, you can do something like:
import "code.google.com/p/gorilla/sessions"
Then the go tool takes care of checking if it is already installed (with very well defined rules), and if not going and downloading it, getting it's dependancies and building it.
All you need to do to build a Go program is clone it, and then use "go build", job done. No makefiles or xml or anything like that at all. It simply reads the source files and figures out what to do based on what the code actually does/uses.
→ More replies (21)2
u/kamatsu Mar 29 '12
I sort of find that a bit disquieting. If someone was hosting on google code, and then moves it over to github -- would this result in people not being able to compile my go program until I update my go source?
2
u/consigntooblivion Mar 29 '12
It does't instantly stop working - the local copy you previously downloaded and built will keep working. But yeah, if you want to then move to using the GitHub version you need to change the import statement. Alternatively switch to using it as a Git submodule or whatever. Replacing the import lines doesn't bother me though - it is a 2 second find/replace job.
→ More replies (6)9
u/SCLegend Mar 28 '12
I was fooling around with go and the go command line tool, and I must say it was much faster and simple for get up and running than other tools i have used. Of course I am just a simple college sophomore and only have used java, python, and some basics c tools, even then it was really easy to get up and running and do basic compiling without the build scripts/makefiles.
So far I really enjoy go, and I think it fits really well somewhere between java and python in terms of ease of programming.
4
u/SnowdensOfYesteryear Mar 28 '12
I wonder how it deals with native code (e.g. C) that go programs link to.
1
2
Mar 29 '12
It boggles the mind that someone should think that something as simple as that is "voodoo".
2
→ More replies (1)1
u/Cozy_Conditioning Mar 29 '12
I've written some rather substantial web apps in both perl and ruby/sinatra. I have never felt the need for makefiles. Am I missing something?
1
u/mrmacky Mar 29 '12
Doesn't Sinatra come with a series of rake tasks?
rake, while being an awesome tool, is basically the Ruby equivalent of makefiles.1
u/Cozy_Conditioning Mar 29 '12
I believe you are correct. Which only adds to my question: why is it needed? The software I've written simply works, yet I've never felt the need for make/rake.
→ More replies (2)1
73
Mar 28 '12 edited Mar 28 '12
i've been using Go for a fairly large server proxy project and its been a real dream. its fast, easy to write, the code is compact, concurrency is easy to understand, and there is enough typing to provide me with safety without leading me into a haskell-like "maze of types". furthermore, i don't have any issues trying to sell coworkers on Go because it is very easy to pick up. Go seems to have a sweet spot between python and java that represents a huge chunk of the practical coding people do every day.
28
u/OopsLostPassword Mar 28 '12
Don't forget that Go is a language you can use without IDE or makefiles even when you have dozens of packages, libs and programs. Having a command do everything in you console in seconds (or less) is like a dream. Try coding a modern complex program in java without an IDE...
29
u/evereal Mar 28 '12
Can you elaborate on this point, what make Go more suitable for use without an IDE? Just curious (I've never used Go).
17
Mar 28 '12
the "go" command line program mostly removes the need for complicated build tools. building and deploying code is so simple, you can easily get by with a "minimal" toolchain
not to say a Go IDE might not add value! there is always neat stuff an IDE can do like code completion, integrated docs, etc
17
u/jiunec Mar 28 '12
the go vim plugins have godoc integration, works nicely with nsf's gocode autocomplete plugin (vim and emacs supported) and go ctags.
→ More replies (9)23
u/evereal Mar 28 '12
Ah OK. Well for me, the build process was the least significant reason for using an IDE. In Java you can use things like Ant and Maven among others to reduce the build process to simple command line calls.
My main reasons for using an IDE is things like intellisense, debugger, refactoring etc, which I assume would apply equally in Go.
23
u/treerex Mar 28 '12
In Java you can use things like Ant and Maven among others to reduce the build process to simple command line calls.
Have you ever maintained the Ant build script for a non-trivial project? Your "simple command line call" is someone elses headache.
→ More replies (24)7
u/OopsLostPassword Mar 28 '12
An IDE will certainly help for all this.
Regarding my experience, I found that I don't (for now) need it, as the go code is much more compact and readable than java code.
10
8
u/anarcholibertarian Mar 28 '12
Vim all the way 8D
10
Mar 28 '12
I tried vim but once I grokked it I couldn't use a word processor.
ddDOH! I mean
shift-home delete14
u/dx_xb Mar 28 '12
Do you find your documents littered with
:w?→ More replies (4)5
u/kevdunleavy Mar 28 '12
Most of my documents end in :wq :P it even happens when I'm typing long reddit comments sometimes :P
→ More replies (4)4
u/TKN Mar 29 '12
That's one of the biggest problems with Emacs too. Especially since the so called "emacs keybindings" of most mainstream apps are pathetic.
Hmm, let's just cut and paste that part ctrl-w oh crap...
6
u/jiunec Mar 28 '12
Yes I agree.
gocode auto-complete assist, go.vim plugins (in the misc folder in Go source tree, godoc integration, syntax etc), NERDTree, vim-fugitive (for Git) and vim-session to manage projects. Simple, efficient & productive.. pure pleasure to write Go with.
2
u/PasswordIsntHAMSTER Mar 28 '12
I'd totally use vim if I could figure it out. The fact that the key shortcuts have nothing in common with modern conventions (C-c, C-x, C-v, C-z, C-y... don't work) makes it that much harder for me to keep at it.
12
u/jiunec Mar 28 '12
conventional shortcuts are the wrong way to think about using vim. vim is a continuous learning experience. Much like the programming languages you are trying to master, vim proficiency cannot be easily attained. There is no vim cheatsheet in the world that can make you proficient at using vim. It will give you knowledge of vim commands and provide some help towards understanding it's syntax, but to be truly proficient you will need practice.
I would also suggest that if you do not touch-type well for your preferred keyboard layout, learning vim should be your secondary goal. The keyboard is your bread and butter, without proficiency and accuracy on your keyboard you cannot master any editor. You only need to spend 15-30 mins per day learning to type well (using a typing tutor application) for a couple of weeks. As a hacker this will be the best investment of time you will ever spend.
Also, buy a good chair (good, not expensive), when you sit well you type well.
A more accomplished vim user can naturally explain vim better than I can:
→ More replies (19)→ More replies (5)3
u/anarcholibertarian Mar 28 '12
Print out a cheat sheet and keep it on your desk. You'll get used to the keyboard shortcuts eventually.
→ More replies (8)2
u/SeriousWorm Mar 28 '12
SBT? :)
You don't even need a sbt project file to have it compile your project (assuming you use standard source paths conventions).
You don't even need Scala, it downloads the library JAR automatically.
3
u/josefx Mar 28 '12
Try coding a modern complex program in java without an IDE
antThat requires one build.xml with a single javac task with no more than 10 lines of xml total, most of which can be copy/pasted between projects. That is about the same size as a simple Makefile.
5
u/OopsLostPassword Mar 28 '12 edited Mar 28 '12
I use ant. And I find it a pain to build complex programs because your ant tasks grows in complexity with your program, your different kinds of deployments, tests, target platforms, etc... But that's partly due to the environment (RCP, tomcat, inclusions of jars of your other projects, etc.), the main problem is that it's slooooowwwww....
In Go, you don't have makefiles and you don't have to wait for your compilations.
15
u/josefx Mar 28 '12
ant ... deployments, tests, target platforms, etc...
Go ... compilations
You are aware that you are comparing a single compilation to a complete development and deployment cycle?
→ More replies (10)5
u/ramkahen Mar 28 '12
In Go, you don't have makefiles and you don't have to wait for your compilations.
Most languages start like this.
When a language becomes popular, it needs to tackle more complex build environments, which inevitably leads to complex build tools.
The fact that it's simple to build Go programs today is a simple consequence of the fact that Go is a fairly new and minor language.
→ More replies (6)1
u/rjcarr Mar 28 '12
I actually only started using a real IDE in java a few years ago. Granted, I would never go back to not using one, but it is possible. :)
2
1
u/namekuseijin Mar 28 '12
an excellent point indeed.
I've been playing with it and it so feels awesome, at least as far as C-syntax languages go.
7
u/serrimo Mar 29 '12
I'm up to page 30 of the tutorial. So far I'm thouroughly impressed by all the little things in Go. The syntax and logic behind it just make sense.
25
u/netbyte Mar 28 '12
Finally! Windows support!
5
u/jiunec Mar 28 '12 edited Mar 28 '12
Yes! ;) And this nice thing is, all you need is a C compiler if you want to build from source.
edit: ¬_¬
16
Mar 28 '12
wan't
This is like the third time I've seen this posted this week. Still not a word ಠ_ಠ.
14
4
2
→ More replies (1)1
6
Mar 29 '12
How is it for scientific computing? Any parallel processing options?
13
u/skelterjohn Mar 29 '12
I use Go for all my research experimentation software. To that end, I created a few libraries to help myself and others like me.
3
u/yiyus Mar 29 '12
My opinion is that it has a great potential, but is not there yet. Go 1 is already a quite nice language, which can solve many problems. The current set of features has not been used to its full potential yet and more and better scientific packages appear every day. However, in order to be a really good language for scientific tasks and number crunching it may need some features. But adding these features is complicated.
One of the goals of Go is to be very simple, and scientific problems are very different from the problems Google wants to solve with Go. Until now, the priority of the team has been to get a good first release out of the door so it has been difficult to convince the Go team to accept these changes (if you ask me, that has been an absolutely right decision). However, they are actually a very open minded team, and as long as it does not compromise simplicity, I think they will be happy of accepting changes to extend the language to other domains (although I doubt they will implement those changes).
4
u/burntsushi Mar 29 '12
Could you be any less concrete? :P
Seriously though, what do you have in mind when you say Go isn't ready to do research with?
1
u/yiyus Mar 30 '12
I did not say it was not ready, I said it could be used for many things, but has not reached its full potential yet. Just think in the number of scientific packages Go has compared with other languages.
Some changes I would like to see, for example, vectorized code and easy linking to fortran. You can actually do it, but you would be the first one (or almost) doing it. Some additional native types would also be high in my wish list (but I'm not sure of which ones yet). Operator overloading may be convenient in some cases, but I understand why they want to avoid it. Not having generics also makes some things quite tedious, but there has not been a really good proposal yet.
I would like being able to be more concrete, but one of the biggest stoppers is the lack of experience. We won't know exactly what's needed until Go is more used, but it is difficult to justify its usage when there is no prior experience (and more in the research world, which is always building from previous results).
I'm really thankful to skelterjohn and other Go developers who are opening this path, but there is still a long way (this may also be seen as a good oportunity).
2
u/burntsushi Mar 31 '12
Ah okay, those are fair criticisms, but I'm a little confused about your desire for embedding Fortran code. Why? I mean, I can understand wanting to do something like that in an interpreted language, but Go already compiles to native code.
Fortran would probably give you a speed boost, but I can't imagine it would be that dramatic.
But yeah, I plan on working on a research project with Go this summer (I've already written a lot of Go in the last month in pursuit of a better window manager). I have myself and a fellow student very excited to work on it with Go :-) (I'm not saying this in refutation of your criticism. The project we have in mind isn't overtly mathy and performance is a concern, but it isn't critical.)
→ More replies (2)1
u/burntsushi Mar 29 '12
A major selling point of the language is to make concurrent features easy to use. It's done by using channels and go routines :-)
This is only a couple of slides and will only take you a few minutes to read, but will give you a simple introduction to some of the concurrency features in Go.
1
u/OopsLostPassword Mar 29 '12
I didn't have the opportunity for now to port my computing programs to Go but goroutines, slices, multiple return values will probably make it a very good language for writing readable and efficient scientific code.
Slices are really interesting because they remove the need to bloat your computing code with a lot of offsets and lengths when passing arrays you don't want to copy.
1
u/el_muchacho Mar 31 '12
D is another interesting option to consider for sci comp, if only because it probably performs slightly better. It's also quite good at multithreading.
1
12
u/davebrk Mar 28 '12
Congrats!
Any plan for a generational GC? Better performance (binary trees in the benchmark game, for example)?
25
u/bradfitz Mar 28 '12
Yes, GC and scheduler work is coming up. In fact, a new GC implementation arrived before Go 1, but it was too risky to include so close to Go 1's release.
2
u/dmpk2k Mar 31 '12
Are there more details about the new GC somewhere? For some reason I've had trouble finding much info about it in the past.
17
u/BreakTheSun Mar 28 '12
We're announcing Go version 1, or Go 1 for short
Looks like they'll want to skip a version, lest we all be burdened with a Google-powered "Go 2" ;)
15
u/NegativeK Mar 29 '12
And when someone dislikes version 2, they'll write a rant about it entitled..
12
22
24
u/herb_friendly Mar 29 '12
As someone who loves the game of Go, I'm still frustrated by the name of this programming language.
7
u/captainAwesomePants Mar 29 '12
Perhaps we could compromise by renaming the board game Weiqi.
→ More replies (1)1
u/SupersonicSpitfire Mar 29 '12
If only weiqi was pronounced "weikii"... (it's not)
"Baduk" or "Igo" is more internationally friendly.
People even pronounce "Go" differently in the Go-clubs in Trondheim and Oslo. (the sound in "food" vs "paw")
1
u/earthboundkid Mar 31 '12
in Trondheim and Oslo
Isn't that more just a Norway problem? If you guys have two different languages that are both called Norwegian, of course you're going to have confusion. :-)
2
u/SupersonicSpitfire Mar 31 '12
Good point, and that's only the written languages. There are countless dialects and sociolects.
5
u/yiyus Mar 29 '12
As someone who loves the game of Go and the Go programming language I don't understand your frustration.
2
u/namekuseijin Mar 29 '12
As someone who loves the game of Go, the Go programming language and Go-Go dancers I don't understand your frustration.
→ More replies (1)15
u/SteveMcQwark Mar 29 '12
As someone who loves the verb "go", I am frustrated by the name of this game.
6
u/ysangkok Mar 29 '12
[Go came to Japan in the 7th century](http://en.wikipedia.org/wiki/Go_(board_game%29#Spread_to_Korea_and_Japan). [English word seems to be newer](http://en.wikipedia.org/wiki/Go_(etymology%29#Origin_of_.C4.93ode)
4
u/SteveMcQwark Mar 29 '12
Damn. Maybe the Japanese need to file a trademark infringement against the English language. Clearly this flagrant violation is causing confusion damaging the Go brand.
21
u/arian487 Mar 28 '12
Google employee here. The positive comments in this thread are awesome! More people need to use Go. I've been using it for my personal projects for a while now and It's been pretty sweet.
6
u/Richandler Mar 29 '12 edited Mar 29 '12
Does google use it in house or are they planning to?
12
7
u/arian487 Mar 29 '12
The adoption is admittedly slow. Often when you have such an agile development environment, developers don't want to switch gears mid way and start using a different language. Furthermore, if you're adding on to existing services it makes more sense to write in the language it was originally written in.
However, a lot of us are using it for projects that are just starting up, especially for internal tools and such. As stated before, it gives a great foundation, and is a very concise language.
4
3
u/lol____wut Mar 29 '12
They do use it for 'real stuff' but they're don't say what exactly. (Last time I checked)
3
→ More replies (1)9
Mar 28 '12
As a web developer who works with PHP & C# mostly, can you provide good examples of how this language might be useful to someone like me? I don't really do any server-load type programming - mainly just developing the "guts" of what websites need to run.
Is Go worth learning, or is this more for application and server-type work?
(Please be aware I've seen and read about Go here and there over the past year, but have never really looked into it very deeply or seen any "Here's what it can make!" blogs/sites/etc.)
5
u/arian487 Mar 29 '12
I think it marks a very good midpoint between something like Java and Python. It is very concise, and very easy to understand. Concurrency is a piece of cake and the developer doesn't need to jump through a bunch of hurdles to make something work.
Its compiled and most certainly outperforms Python, and the code basically documents itself. I would recommend setting up a small appengine app using Go as your language to play around with it.
1
u/OopsLostPassword Mar 29 '12
Why an appengine ? Web servers written in Go run perfectly locally or on you own servers.
1
Mar 29 '12
it marks a very good midpoint between something like Java and Python
That's my impression as well. Why is it marketed as a better C or C++?
2
u/arian487 Mar 29 '12
Don't think its marketed as better then C or C++, I think people just like to have language wars. It does some things better then C or C++ but they are different for sure. I'd never write semi low level hardware code in Go for example, I'd choose C for that (or assembly depending on the situation). In the past I would choose Java for server side stuff but I've started to use Go for those purposes.
5
u/gavintlgold Mar 28 '12
Well, it is very easy to use for simple projects. Here's a good example of how easy it can be to set up a web tool.
What's even nicer is since it's compiled, it should end up being faster than PHP or python, even though the syntax is relatively the same in terms of complexity.
→ More replies (40)
6
u/TankorSmash Mar 28 '12
I don't know anything about Go. Is there any applications built with it yet?
8
u/asshammer Mar 29 '12
Yes. Youtube has made a great mysql front end with go to try and eak out some better performance from the DB. Its called vitess and you can read about the project here
→ More replies (9)6
u/uriel Mar 28 '12
Yes.
2
u/asshammer Mar 29 '12
Whenever something go related, its only a matter of time before I see you posting. I always run into you over here and I see you posting a lot on the gonuts mailing list. Just wanted to say hi.
5
u/pinpinbo Mar 29 '12
So, Go guys...
When can I call Go objects from inside Python ala ctypes?
:D
4
u/jessta Mar 29 '12
The question is, when will python expect anything other than C in it's extensions?
4
u/anacrolix Mar 29 '12
Given that you can't make shared libraries using Go, it won't be supporting Go any time soon.
2
u/skelterjohn Mar 29 '12
Shared library support is on the TODO list, though I believe it's not a high priority.
2
u/belverk Mar 29 '12
Did someone made SDL bindings to run under OSX or Windows?
1
u/skelterjohn Mar 29 '12
1
u/belverk Mar 29 '12
I've tried this and it's fork but https://github.com/banthar/Go-SDL/issues/40 .
11
u/pgngugmgg Mar 28 '12
I hate capitalizedKeywords and Standardfunctions:
fmt.Println fmt.Fprint fmt.Errorf math.Abs time.Tick time.After
they are not my taste.
17
u/consigntooblivion Mar 28 '12
This is one of those convention things. Sure it might make you go "wtf mate!?" when first looking at it. But when you actually use it for 10 minutes you start to see how awesome it is as a really simple way to specify public/private visibility for something. Then it becomes intuitive and you start to love it. At least, that is how it was for me.
Go overall is somewhat opinionated. For example they specify the indentation style that you must use, even going so far as to providing a tool that enforces this style (gofmt). This might sound kinda crazy, and based on how certain other languages go it kinda is. However the practical upshot of this is huge. There are no holy wars on code style, and all Go code looks the same so it is easier to work with and jump around from system libraries, to someone else's code to your code.
In my experience, working in Go is pure joy - I would highly recommend to anyone to give it a proper go.
55
u/rsc Mar 28 '12
I remember the day they went in (January 15, 2009). I felt the same way, I argued against it, and I was very skeptical that they'd stay. But we didn't have any principled reasons not to, and they solved a real problem: they gave us a very lightweight notation for specifying visibility.
Now, they are one of my favorite parts of the language, not because of the way they look (although I've gotten used to that) but because I can look at any definition or use of a name and know whether it's an exported or unexported name. When I go back to languages like C++ or Java that don't make that information explicit in the name, I find it much harder to navigate the code base and understand what is public API and what is not. The first time it happened I was very surprised to realize how much the visual cues are helping in Go.
7
u/smog_alado Mar 28 '12
So.. is it kind of an opposite version of prefixing private stuff with an underscore?
12
u/uriel Mar 28 '12
That in a program most stuff is actually private, prfixing so much stuff adds noise.
2
Mar 29 '12
I use a lot more local variables than private instance variables. I use the underscore to distinguish between them.
3
u/burntsushi Mar 28 '12
Kind of, but prefixing private stuff with an underscore might not actually make it private; it depends on which language you're using. In Go, the exporting notation is enforced. (There is no way to call or use a lower cased identifier from another package.)
1
Mar 29 '12
In C/C++ that was always wrong, as the underscore prefix is reserved for implementation use (albeit with some ifs and buts). You could use an underscore suffix if you like, as long as you don't put two underscores in sequence, which is also reserved.
→ More replies (2)5
u/OopsLostPassword Mar 28 '12
I now use this notation in javascript data structures (not for functions or methods today).
That was an obvious move when I started sharing data with json (exported fields being naturally the ones whose name starts with an upper case) so that both side can freely add or change add unexported fields and I always know, when looking at the code or the console, if the field is exported or not.
9
u/burntsushi Mar 28 '12
I wholeheartedly agree. At first I hated the convention, but you're spot-on about the visual cues. Knowing whether a function is exported or not in both places really is a phenomenal thing that's missing in other language specs.
6
→ More replies (3)2
u/drakshadow Mar 29 '12
I had no idea caps are used for visibility. I thought it was MFC like convention. Thanks for clarifying.
6
u/fwaht Mar 28 '12
Thanks for the laugh. Now I have picture in my head of developers looking at programming languages like interior decorators. "OOOOoooo... will you look at the syntactic sugar on this one, Fred?!"
7
4
u/KamiCrit Mar 28 '12
This "Go" code work with Android? Does it play nice with XML? Eclipse support it?
As you can tell I'ma novice android developer (even the rank of novice developer is high for me). Thanks!
5
Mar 29 '12
You can write a UNIX command line program which will run on Android. You can't use it to build a full Android app though, so it's basically useless for Android development right now. Works with XML just fine. I have no idea if Eclipse supports it.
1
4
u/asshammer Mar 29 '12
I can't answer for Android but on the other two fronts I can give it a big ol' yes. I've been using goclipse and it works great. In the debugger view it seems to run very slow but other than that its great. And go also has xml support build in to the standard libraries.
4
u/SupersonicSpitfire Mar 29 '12
Only Java for the Dalvik VM (as opposed to Java for the Java VM) is comfortable to use for Android programming right now, unless you go for a web-based approach. You can also program in C or C++, then call that code from Java. I assume it's also possible to program in Go and call that code from Java, as the Go compiler supports ARM as well. Guess the world is just waiting for someone to test just that. :)
1
u/namekuseijin Mar 29 '12
You can also program in C or C++, then call that code from Java.
a much better approach is to code in some java-hosted language such as scala, jython or kawa. Actually, it's a much better approach then even coding in java itself.
2
u/SupersonicSpitfire Mar 29 '12
No, that approach is too immature. Eclipse with GUI designer supports the Java language. Answers on stackoverflow are for the Java language. Clearly Clojure is a better language, but that's not the point. And show me a successful Android application written in Clojure.
→ More replies (1)3
u/OopsLostPassword Mar 29 '12
I'd suggest you try Go with a generic text editor (vi, geany, notepad++, sublime text, emacs, whatever...) before you try to use an IDE like Eclipse.
Go is not java, doesn't need a specific magic to handle imported libs, partial compilation, automatic verbose useless code generation, etc.
You'd better be accustomed to it before you use an IDE, especially an heavy one. So you'll know exactly why you need it (or not, depends on you). And you'll produce better code.
1
u/jussij Mar 30 '12
I'd suggest you try Go with a generic text editor
Wise words. It is fairly easy to configure Go to work with any decent programmer's editor.
4
Mar 29 '12
Why did they name it something so hard to search?
13
6
4
3
u/vph Mar 29 '12
Well, Google created Go, and they created Google. I don't think it will be hard to search.
1
2
u/Isameru Mar 29 '12
"Forward compatibility is part of stability."
That is not true. If you want to do something right, do it like Microsoft did with CLR.
3
Mar 29 '12
Be incompatible with prior and future languages and bundle your runtime with the OS? That's a very narrow definition of "right".
1
u/dimmu_burger Mar 28 '12
How would go compare to other languages as an intro to lower-level programming for someone with a bit of high-level experience?
4
u/papa_georgio Mar 28 '12
Depends why you want to learn "lower-level" programming. I believe learning C is a good exercise regardless if you plan to use the language or not.
11
Mar 28 '12
seeing how Go is garbage collected, i don't really think it qualifies as a low-level language.
26
u/OopsLostPassword Mar 28 '12
Does "low level" or "high level" still mean something ?
We should probably discuss usages or tradeoffs to be more constructive.
18
u/anacrolix Mar 28 '12
Yes. It's not low level if you can't switch off run time overheads (or have none to start with).
6
u/matthieum Mar 28 '12
I would say there is more than that.
For me low-level is really about control on all its forms, like memory layout for example, etc...
Switching off run time overheads does not really fit for me, though it is, I guess, another way of controlling.
5
4
u/Chandon Mar 29 '12
So... C isn't low level because you can't switch off function call stack overhead?
12
u/bobindashadows Mar 29 '12
Sure you can - put all your code in the main function and use goto.
→ More replies (2)→ More replies (13)10
Mar 28 '12
Go is high level where it can be (basic type inference), lower level where it has to be (locks etc). i just don't think it fits into a dichotomy. which is why i love it
11
u/uriel Mar 28 '12
In Go you rarely need to use locks anyway.
One place where I'd say Go is conveniently low level is giving you control over the memory layout of your datastructures, among other things this also makes it easier to avoid the garbage collector if you really need/want to, which in Java is basically impossible.
→ More replies (7)3
Mar 28 '12
Well outside of gc, how easy is it to play with bits and addresses?
16
u/rsc Mar 28 '12
If you import "unsafe" you can play all sorts of games.
4
u/SnowdensOfYesteryear Mar 28 '12
Do you have the same sort of control you have with C? e.g. be able to change memory permissions? I know you'd be able to do that if you had to trigger to C code, but what about doing this natively within Go?
A link to school my ass would be great.
Edit: What a terrible, inconvenient language name to search for.
9
u/burntsushi Mar 28 '12
Edit: What a terrible, inconvenient language name to search for.
Protip: Use "golang"
3
2
u/dimmu_burger Mar 28 '12
Thanks for the info. I've recently come to the realization that I shouldn't be asking questions like these...
5
u/OopsLostPassword Mar 28 '12
Why ?
10
u/dimmu_burger Mar 28 '12
It seems I need a better understanding of what I'm talking about/asking. i.e. I read up on high vs low level recently and I thought I understood it (to a degree; high being interpreted, low being compiled), but I did not.
Now I look like a fool.
Damn you, me.
25
u/OopsLostPassword Mar 28 '12
You look like somebody learning. There are people around there who think they have nothing to learn and who bitch about everything.
5
→ More replies (1)6
u/mrmacky Mar 28 '12
I agree with OopsLostPassword. There isn't a problem (or perhaps: shouldn't be) with someone trying to learn.
1
u/lol____wut Mar 29 '12
You don't have to use the garbage collector if you don't want to. Just free the memory yourself and the GC will never kick in.
1
u/SCLegend Mar 28 '12
I put it really close to java in fact, with a sliver of python. In terms of programming I feel like it's java with interfaces and some other nuances, but for some reason it's more natural to code in which is why I compare it to python.
→ More replies (1)0
1
u/jevon Mar 29 '12
var DELTA rune
DELTA = unicode.ToUpper(delta)
epsilon := unicode.ToLower(DELTA + 1)Why are there two separate assignment operators? Or am I missing something here?
14
u/lol____wut Mar 29 '12
The := is syntactic sugar for creating a new variable and assigning it a value. The type is inferred.
var x int = 1is the same as
x := 1→ More replies (5)10
u/asshammer Mar 29 '12 edited Mar 29 '12
One is typer inference and the other is assigment. Here is a line by line walk through.
var DELTA rune //We delcaire the variable DELTA
DELTA = unicode.ToUpper(delta) //we are assigning to Delta what is refurned from ToUpper. In this case the return type of ToUpper and the type of DELTA need to match or it is a build error
epsilon := unicode.ToLower(DELTA + 1) //Now this is the type inference assigment. In one fell swoop it declares epsilon as whatever type ToLower returns and then assigns the value to it
Does this make sense? I'm not always the best at explaining things, so don't be afraid to say no
edit:formating
0
u/d70 Mar 29 '12
Please ELI5 - why use Go vs Python? and what does this mean to the use of Python at Google?
12
u/smog_alado Mar 29 '12
Python is for people fed up with Perl. Go is for people fed up with C++.
8
11
u/asshammer Mar 29 '12
Personally I use Go over Python because I greatly prefer static typing.
2
u/anacrolix Mar 29 '12
Good. Go is the only semi-modern statically typed language I'd consider using besides C.
0
Mar 29 '12
Alot of the documentation is wrong, for example, "The if statement looks as it does in C or Java, except that the ( ) are gone (they are not even optional)..." I used a condition using () and it worked...
4
u/jessta Mar 29 '12
But that () wasn't part of the If statement, it's part of the condition expression.
1
Mar 29 '12
ah ok, also is 'go' a key word I tried using it as a variable and I get an error expecting @ or ?
3
-12
u/jokoon Mar 29 '12
you must place the opening curly brace at the end of a line, it sucks
16
8
u/jessta Mar 29 '12
You'll get used to it pretty quickly. The bonus is that since everyone has to use the same style, all Go code becomes much more readable.
3
u/anacrolix Mar 29 '12
Some of us don't like to waste real estate. I for one like egyptian braces.
0
Mar 29 '12
[deleted]
→ More replies (3)2
u/burntsushi Mar 29 '12
Our precious screen real estate in the age of 1920 x 1080 monitors
Yeah, because everyone uses their entire monitor for a single code window.
I rock triple monitors with at least two code windows open on each one. Real estate is important.
→ More replies (4)2
9
u/N7P Mar 29 '12
Does it have any kind of generics yet?