Go (not the board game)

Nov 12, 2009 22:07


As you may have heard, a few days ago Google released a new programming language that they'd been developing for awhile. And by "they", I mean Rob Pike and Ken Thompson, both of whom were instrumental in the creation of Unix, its predecessors, and its successor. They also invented UTF-8. So, you know, there's some reason to pay attention.

As it ( Read more... )

development

Leave a comment

Comments 5

q99 November 13 2009, 08:59:10 UTC
I've never learned a programming language but I have enough background in them to find that kinda interesting :)

Reply


aoanla November 13 2009, 09:37:44 UTC
To be fair, Hello World is a big executable partly because the fmt package is horribly complex and pulls in multiple other packages (including reflect, so it can provide a %T for type-of-variable format string, amongst other things.).

I did hit precisely the same problem as you as regards declarations - the syntax looks superficially C-like-enough that it confused me into making the wrong inferences about the structure.

Reply

aoanla November 13 2009, 14:55:49 UTC
Also, also:

Go does have an FFI, however, it isn't well documented (at all). There's example code here: http://code.google.com/p/go/source/browse/misc/cgo/gmp/gmp.go?r=release
though.

Reply

mcmartin November 13 2009, 18:32:30 UTC
It's less that it's complex and more that they are statically linking their equivalent of glibc; if you pass -static to gcc when compiling Hello World, you get a 579KB executable. The additional overhead is fairly low, but the initial constant factor is absurd.

Reply

mcmartin November 14 2009, 07:59:05 UTC
I did manage to get reflection to work, incidentally; there's probably an easier way to do these, but I was trying to maintain type safety and error-check every step of the way.

I wrote one function that enumerates all the fields of a struct you pass it, and another that takes a pointer to an object that has a "Gold uint16" field and force-sets that field to 9999. I suspect for a less contrived application type-switching will come in more handy.

Reply


Leave a comment

Up