Go Version 1 Released 186
New submitter smwny writes "Google's system programming language, Go, has just reached the 1.0 milestone. From the announcement: 'Go 1 is the first release of Go that is available in supported binary distributions. They are available for Linux, FreeBSD, Mac OS X and, we are thrilled to announce, Windows. ... Go 1 introduces changes to the language (such as new types for Unicode characters and errors) and the standard library (such as the new time package and renamings in the strconv package). Also, the package hierarchy has been rearranged to group related items together, such as moving the networking facilities, for instance the rpc package, into subdirectories of net. A complete list of changes is documented in the Go 1 release notes. That document is an essential reference for programmers migrating code from earlier versions of Go. ... A similar process of revision and stabilization has been applied to the App Engine libraries, providing a base for developers to build programs for App Engine that will run for years.'"
Go is already being used (Score:5, Interesting)
The amazing thing is that even before the first stable release is out quite a few organizations are using Go in production to run real systems. Very impressive:
http://go-lang.cat-v.org/organizations-using-go [cat-v.org]
Re: (Score:2)
Re: (Score:3)
Added value of Go? (Score:5, Interesting)
Re:Added value of Go? (Score:5, Informative)
Re:Added value of Go? (Score:5, Interesting)
Maybe I'm too old-school, but when I think "systems language", I think about something that would be good for embedded devices or kernel device drivers, stuff that's pretty close to the metal. I wouldn't use Go for that, garbage-collection and concurrency mean there's heap traffic and IPC signaling under the hood that I probably want to control.
I agree with the "C but better" characterization, but the ways in which it's better disqualify it from being a good systems tool, I think.
Re:Added value of Go? (Score:5, Informative)
Maybe I'm too old-school, but when I think "systems language", I think about something that would be good for embedded devices or kernel device drivers, stuff that's pretty close to the metal. I wouldn't use Go for that, garbage-collection and concurrency mean there's heap traffic and IPC signaling under the hood that I probably want to control.
Java is used in a lot of embedded systems, and it has garbage collection and concurrency.
Unlike Java, though, Go compiles to native binaries, rather than running on a VM (though maybe the real difference is debatable with modern JITs).
Re: (Score:3)
Embedded has become a rather broad space these days as the range of computing hardware that's built into other devices gets more powerful at the high end.
Like the GP I think I'd usually prefer to think of a "systems language" as something that's suitable for kernel programming and for the low cost / simple CPU end of embedded work, where things can still be very highly resource constrained. But I can see why they're calling Go one, since I'd also expect a "systems language" to be suitable for writing OS ut
Re: (Score:2)
Yeah, I think their definition of a "systems language" is broader than that. Maybe on Plan 9/Inferno, the predecessors of Go qualified as systems languages, because the OS provided a lot of the infrastructure for what they did. On other operating systems, the language itself has to provide that same infrastructure (e.g. garbage collection), so to call Go a strict systems language is a little specious.
Re: (Score:3)
I don't know whether Java is poorly suited to embedded environments
It is. I mean, it's a language that doesn't have stack-allocated user-defined types or arrays or primitive types - how's that for embedded?
The fact that not only was it pushed for that role, but enough people actually bought into it, tells you all you need to know about the average IQ of homo sapiens.
Re: (Score:2)
Re: (Score:3, Interesting)
Re:Added value of Go? (Score:5, Informative)
Re: (Score:2)
So, basically, Go doesn't compile to native code, it just wraps the runtime engine (VM?) with it ....
Re: (Score:2)
No. It statically links all the IO libraries. Which seem pretty bloaty but it's a bloaty world isn't it. Not the bloatiest pig on the farm though.
Re: (Score:2)
Re:Added value of Go? (Score:5, Insightful)
It is supposed to be a systems language like C, but better.
IMHO, if it isn't standardized, opened up and backed up by an international standard then it will never be better than C. For all problems that may or may not affect C and for all problems involved in the development and update of a standard for each version of the C programming language, these multiple versions of the C programming language are effectively set in stone. This means that the language is future-proof, as multiple implementations may be developed and, by targetting the standard, they can interoperate without any major consequence.
If Go isn't standardized and if Google intends to control the language then it would be a terrible decision to adopt Go instead of a time-tested, well established tool which is future-proof and resistent to bit-rot. We all have Oracle and Java [javaworld.com] as a good warning.
Re: (Score:2)
I have a generally better feeling about this project than I ever did about Java or C#. It seems like the prevailing sentiment is common sense. But mind you, maybe that is becuase I have not yet tried it. But I will fix that now.
Re: (Score:2)
OK, I checked out the merurial repo (good taste!), built it and ran hello.go. Just one thing: the syntax "go run hello.go" is stupid, it should be "go hello.go" and --options for anything else you want to do.
Re: (Score:3)
Re: (Score:3)
I spent a little time playing around with it a few months ago. It had its good points and bad points -- enough of the latter that I didn't pursue it any further.
The syntax is obviously C-inspired, but with some changes, many of which seemed like experimentation -- doing something different just because it's different. Although I don't object to the philosophy, I'd like to see how those changes work out before investing a lot of time into them. In particular, the declaration syntax feels very strange to p
Re: (Score:2)
Perhaps this section of the FAQ might be useful in explaining some of those changes. Another page explaining the declaration syntax in particular can be found here.
I did read both of those pages while looking at Go. Their rationale for the declaration syntax was mostly that C-style declarations can get confusing when complex function pointers are involved. That's true, but from their examples it's obvious that compound declarations involving function pointers is confusing in Go as well -- if there's an advantage in readability for Go declarations, it's a small one, and I don't believe that it is enough to justify going against existing expectations.
They also neglect
Re: (Score:2)
But I think that if you're going through all the trouble of designing a new language, you might as well fix as many problems as you can, no matter how small. Certainly compound declarations with function pointers are complex, but I think the ability to read the declaration from left to right is a major improvement over the Clockwise-Spiral Rule [c-faq.com] of C.
Don't forget - for me, it's not an improvement. After all, I already know how to read C-style declarations. Also, keep in mind that declarations of the sort that they are using for examples are exceedingly rare -- I can't ever remember wanting to declare a function that takes a function pointer as a parameter and also returns a function pointer. I'm sure that it comes up occasionally, but considering that I write C professionally and have never seen it, it's not the kind of thing that seems worth buildin
Re: (Score:3, Insightful)
I would stay away from Go and pick up Python. It has lots of good libraries and frameworks. Its used in some games and lots of open source projects as their scripting language. Python is a very expressive and general purpose language. It does not appear to be going away within the next decade and in fact I expect Python to become much more prevelent once PyPy becomes more robust. Added to all that, extending Python with commonly available libraries is not a difficult task and there are numerous approaches (
Re: (Score:2)
Yeah, I'm waiting for PyPy to be Python 3 compatible, then jumping head-first into it and not looking back.
Re: (Score:2)
We use Python quite a lot in my field of work (computational neuroscience). The main tool I sue right now is slowly, gingerly, gradually removing support for Python 2.4 over the nex year or so, and will require 2.5 or later from then on. Python 3 is not anywhere on the horizon and won't be for a long time.
I don't expect to even take a serious look at Python 3 before the end of this decade.
Re: (Score:2)
Go isn't intended to replace web scripting languages. Dart is their language intended to replace JavaScript, and it's going to go exactly nowhere.
I'd suggest Python to replace PHP, and jQuery to abstract away the bulk of the pain of multi-browser JavaScript.
But it depends on if you're talking continuing to do web stuff, or if you want to do something else.
Re: (Score:2)
Sounds like Python is appropriate for almost all situations, though, so maybe that's a good direction to pick.
Re: (Score:2)
Yeah, Python can definitely be used for non-web stuff. I just saw a video about a guy who used Python to interface with openCV (computer vision) to make a squirrel-shooting watergun. He used Python and openCV to take images from a webcam, and allow it to know the difference between squirrels and birds, and only shoot the squirrels away from the bird feeder. Pretty fun stuff.
Re:Added value of Go? (Score:4, Informative)
What is the purpose of the project?
No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously. There are several trends:
We believe it's worth trying again with a new language, a concurrent, garbage-collected language with fast compilation. Regarding the points above:
Re: (Score:2, Insightful)
Go may be a fine language. I'm not sure, I've not really looked at, but it does have some neat things in it. However, that does dound a little fuddy to me.
Computers are enormously quicker but software development is not faster.
I program mostly in C++. In the last 10 years, even ignoring C++11, the C++ landscape has changed enormously, with compliant compilers and advanced libraries. C++ today is nothing like C++ in 2002 and even the same language has turned into a much more effective platform.
There is a gro
Re: (Score:2)
In the last 10 years, even ignoring C++11, the C++ landscape has changed enormously, with compliant compilers and advanced libraries.
It's still stuck with the crappy #include mechanism instead of proper modules, along with slow compile times, plus the many traps and pitfalls that come with the language. C++ as a language is fearsomely complex.
programmable typesystems have become more mainstream
Really? Do you have real-world examples to cite? I also don't think the backlash against static type systems has disappeared. It's a constant source of contention.
Some popular languages don't generate garbage in the first place (and can automatically clean up any resources). It's obvious they're taking a dig at C++ there.
RAII comes at a cost (the programmer has to carefully implement it) and places limits on the structure of your program (such as avoiding
Wake me (Score:2)
Wake me when it has supports seemless integration into Python like Fortran and C (with ctypes) -- then I might consider it for coding CPU-intense stuff. It's supposed to be as fast as C with better syntax, isn't that the point?
Re: (Score:3)
What's the point in that? Go is very expressive. Just write in Go instead of Python.
Yes, because all libraries in the world are already written in Go and everything is better in Go than in any other language in the world. You must only work on trivial problems if you don't need other packages / shoulders of giants.
Re: (Score:2)
Re:Wake me (Score:5, Insightful)
Re:Wake me (Score:5, Insightful)
The GP referred to Fortran and C as well as python.
Increasingly we're seeing lots of legacy code (C / C++ / Fortran) wrapped in Python. People using Python for simplicity and expressiveness, dropping to C , etc. for the heavy lifting. This is especially true in the sciences (in HPC, for example).
Trying to avoid the language flamewar, there are distinct advantages in a small number of interoperable languages like this.
If I'm to try a new language, I want to avoid having to rewrite the world in it. I might convince my colleagues to use my code if they can interop. from the language they are already using, like C/C++ or Python.
Re: (Score:2)
[...]
Increasingly we're seeing lots of legacy code (C / C++ / Fortran) wrapped in Python.
That does not make sense, you are just confused.
OP is correct and it seems YOU are confused. A huge portion of the python libraries are just wrappers for fortran/c/c++ libraries. Pretty much every useful Fortran/C/C++ library out there has a python wrapper! For those that don't, tools like swig and cython make it trivial. I can usually wrap a fairly complex library in less than an hour.
People using Python for simplicity and expressiveness, dropping to C , etc. for the heavy lifting.
You mean they use Python to express themselves and C and FORTRAN to program?
Again, you are an idiot, and the OP is correct. You write all of the tedious bullshit in python. This takes a small fraction of the code/time that it would take to implement in C. You then identify the areas that need speed and either develop a C library, or just use some of the nice feature in cython. The end product is an application that took WAY LESS TIME to develop, and runs at practically the same speed.
This is especially true in the sciences (in HPC, for example).
You do know what HPC mean, right?
I DO! Part of my work is in HPC. Python is easily the fastest growing language in the field. Again, users can take decades of C and Fortran legacy code and effortlessly upgrade to the ease-of-use/rapid development of python without really sacrificing any performance. Furthermore libraries like numpy, scipy, matplotlib, guiqwt, pyfftw, pycuda, mpi4py etc. etc. make developing new HPC applications easy.
[emphasis in bold added]
Dear Anonymous Coward,
I'm glad to hear that Python lets you express yourself so eloquently!
Wish you a many successful HPC wrappings [after] writing "tedious bullshit".
Re: (Score:2)
Go has some good ideas (Score:2)
Re:Go has some good ideas (Score:4, Insightful)
Re: (Score:3)
Really... *nobody* cares what style *you* prefer.
The most important person who cares what style he prefers is him. Really, that's all that matters.
It's a silly reason to drive people away from your language. I'm sure a smart preprocessor could deal with many indent styles just fine, but what's scary is when the language developers say, "here is how you will use our language." Because other people always find more clever things to do with flexible languages than the designers intended. That's just being
Re: (Score:2)
Every person who ever reads your code disagrees. Programming is not a solitary activity.
And in the mid-80's I was handing in work sets that needed to be run though a pretty-printer before submitting so the teacher only saw one typesetting variation (his preference). What's the excuse today? This was on a z80 card running in an Apple ][ and that ran in realtime so there's not a horsepower problem.
How does having a canonical brace format in any way limit what you are able to do with the language?
Does it not
Re: (Score:3)
The style, or your preference for a particular style, is not important in the least. What's important is the consistency. Really... *nobody* cares what style *you* prefer.
Go has "gofmt" which reformats code to a sensible standard and is also used by editors, so basically all code in Go is formatted consistently. There really isn't any discussion on formatting; everyone has taken the attitude of 'whatever gofmt does is fine, and that's the standard we'll use.'
Re: (Score:2)
Re: (Score:2)
The semicolon issue probably isn't any more significant than Python's indentation based syntax. Both can work, and both require adjusting to. And both are a nuisance. I refused to use Python until they officially allowed tab based indentation (as long as you were consistent about it). I.e., as long as Python3000 was going to disallow tab based indentation, I wasn't willing to bother learning it. When they changed that, I found it something I could adapt to. I still find it annoying, but every language
Re: (Score:2)
It forces you to write the opening { on the same line. You can't write code like this:
foo(blah blah blah)
{
other foos
}
You *have* to write it like this:
foo(blah blah blah) {
other foos
}
For the record, I see this as an advantage, not an issue. But other people differ.
Re: (Score:2)
I'm with the former, but I get tripped up by auto-indentation that either adds tabs to or b0rks when I write this
if( a==b )
{
}
else
if( c==d )
{
}
else
{
}
yes that's a lot of vertical space but I find it easier to follow, if it's my code in my project on my computer that I'm not even sharing then I should be able to do that!
Re: (Score:2)
You will probably be a lot more comfortable using a switch statement. I think they are more idiomatic than if - elseif -elses:
switch {
case a==b:
f1()
case c==d:
f2()
default:
f3()
}
Re: (Score:2)
True, but you can't put login in the Case in all the c-syntax languages that I use
Re: (Score:2)
I don't understand. What do you mean by "putting login in the Case"? And what do other languages have to do with this?
Re: (Score:2)
IMHO the indent wars are best solved in the editors. For example, I've always preferred tabs because one tap of the tab key gets me to the start of the line. Holding down the spacebar is not ergonomic for me. I always overshoot or undershoot.
I could fire another salvo in the tabs vs. spaces war, or I could have an editor that's smart enough to look at spaces at the beginning of the line and let me tab through them. Problem solved.
I don't like Go's K and R indents either. This is only marginally more t
Re: (Score:2)
Re: (Score:2)
That would involve modifying the code. The crux of my argument is that it's a problem with editors, not code. Think "document view architecture".
Beard? (Score:2)
Do the developers of GO have beards [techcrunch.com]?
GO is the next major language (SQUIRREL!) (Score:2)
Just like google real estate will transform the industry (SQUIRREL!) and google's solar power efforts will transform the world (SQUIRREL!) and google's anonymous accounts that protect user privacy (SQUIRREL!).
Sure, I'll invest my precious time in Go. You bet.
Re: (Score:2)
The amazing thing about corporations is that they are comprised of many individuals who can concentrate on many things at once without being distracted by what color squirrel is running past the office in some other lab.
What is go? (Score:2)
Answer: It is the follow on to Limbo.
It lacks a lot of things that you would expect (Score:2)
Re: (Score:2)
Given what a clusterfuck OOP has been, it's good to see new languages have jumped off the sinking ship. Inheritance makes for bloated, unreadable code. Good code uses composition instead, which means you don't have to spend hours tracking down weird vtable bugs.
In no programming language should you ever have to worry about the vtable, in fact you should only be able to be aware of it in system programming languages. I haven't come across bugs in inheritance since the very early days of C++, when it was implemented as a preprocessor for c.
That said I know that inheritance is one of those things that people disagree on, and thinking that we are better off using composition is a respectable stance. That said, though I would be the first to acknowledge that inherit
Re: (Score:3)
Take a look at type embedding: http://golang.org/doc/effective_go.html#embedding [golang.org]
Go does not provide the typical, type-driven notion of subclassing, but it does have the ability to “borrow” pieces of an implementation by embedding types within a struct or interface.
Re: (Score:2)
Take a look at type embedding: http://golang.org/doc/effective_go.html#embedding [golang.org]
Go does not provide the typical, type-driven notion of subclassing, but it does have the ability to “borrow” pieces of an implementation by embedding types within a struct or interface.
That's interesting. I can see that they have gone full hog with the composition paradigm and given some innovative ways of implementing it. I will really have to take a look at this.
It seems to me that go is almost the direct opposite of Scala. Scala takes the approach that anything that the compiler can possibly infer it should do, regardless of impact on compile time, whereas go takes the approach of designing the language to facilitate fast compile time. Scala draws from the inheritance model - introdu
Again, Really? (Score:2)
I was SO hoping this would be another abandoned project
The syntax just blows!
Rube Googleberg Machines? (Score:2)
FTFA:
I looked at the Go pages for 15 minutes to try to figure out why this was commissioned as a project to begin with. Ultimately I ran into the above paragraph. Projects like this make me think that Google no longer has a clear idea
Re:Rube Googleberg Machines? (Score:5, Informative)
I don't think you fully grok what they have achieved. Google employs only a handful of people who work on Go, and probably not all them work full time on it (though maybe that's not true lately in the last release cycle).Let me give you a quote from an accomplished (hint, you use his code every day) C & C++ hacker on using Go:
"In my experience Go is probably 5-10x faster than C or C++. I estimate that programs that take me half an hour to write in Go would take me about 2½ hours in C and 5 hours in C++."
Then when you only have to wait about 10 seconds or so for the whole Go std library *and* all your own libs and binaries to build, you can see it's value over waiting for large C++ projects (of which Google has many) to build.
Re: (Score:2)
I don't think you fully grok what they have achieved. Google employs only a handful of people who work on Go, and probably not all them work full time on it (though maybe that's not true lately in the last release cycle).Let me give you a quote from an accomplished (hint, you use his code every day) C & C++ hacker on using Go:
"In my experience Go is probably 5-10x faster than C or C++. I estimate that programs that take me half an hour to write in Go would take me about 2½ hours in C and 5 hours in C++."
Who's that? One of the Go designers, perhaps? He's doing something fundamentally wrong if it takes him more time to code in C++ than in C.
Then when you only have to wait about 10 seconds or so for the whole Go std library *and* all your own libs and binaries to build, you can see it's value over waiting for large C++ projects (of which Google has many) to build.
Long compile times is more of a build system problem than a compiler problem, IME. Of course, lots of people have broken build systems, and compile the same things over and over again ...
Re:Rube Googleberg Machines? (Score:5, Interesting)
I write both Go and C++ at google. Sadly, Rob Pike's joke has a definite core of truth: writing C++ code at google is extremely time-consuming and difficult to get right because it has to be multi-threaded and asynchronous.
Long compile times is more of a build system problem than a compiler problem, IME. Of course, lots of people have broken build systems, and compile the same things over and over again
Well, our in-house developed build system is the best I've ever seen, and probably the best in the industry. Read more about it here [blogspot.com]. Even with all the niftyness of a thoroughly correct build system and a data-center sized ccache, it still sucks.
Go is definitely awesome, and I recommend everyone to set aside the gripes with the syntax and learn it. I guarantee you that you'll be pleasantly surprised.
Re: (Score:2)
You know all you 'whatevers' whining about syntax reminds me about what George Carlin said about "bad hair days".
"Put on a hat and go to work you shallow ..." -- George Carlin
In other words:
Reset your damn editor and get to work! -- me
Re: (Score:2)
Extraordinary claims require extraordinary evidence. And the evidence that is out there states that the claim Go is 5-10x faster than C or C++ is bullshit. In fact, it's slower. [debian.org]
Notice the benchmark where Go took 30x the time the C program did to finish the benchmark?
Re: (Score:3)
He is saying that Go is 5-10 times faster to compile than C++, not that the output binary runs faster.
Re: (Score:2)
Notice the benchmark where Go took 30x the time the C program did to finish the benchmark?
Apparently this is a case of the C program using a mature library to do the heavy lifting. The Go program uses a slower library. Neither the C program nor the Go program actually implement the algorithm so it is a poor test of the languages and compilers. Instead it is a test of the libraries.
A practical program depends alot on libraries so I am not trying to talk down the significancy of a slow library. I am just pointing out that as a language and as a compiler the Go team is appears to be doing fairly we
Another new langauge? (Score:3)
How does this language compare with Mozilla's new programming language?
Time to Give Go Another Look (Score:3)
First time I looked at Go, my conclusion was "this language isn't ready". The next time I looked at Go, I concluded that it had essentially bled to death. But the release of version 1 changes things. I will take another look. I hope they've worked out enough of the details for me to be able to tell if this is a language I would love to work with or not.
Re: (Score:3)
The semicolon at the end of the line thing decided me that it was a toy language. That the meaning of the statement(s) change if the semicolon is on a new-line or on the same line.
Re: (Score:2)
> That the meaning of the statement(s) change if the semicolon is on a new-line or on the same line.
I don't know what you mean. In Go, semicolons are clearly stated *not* supposed to be used to end lines. There is no ambiguity there.
Re: (Score:2)
I can't remember the specifics now, but it was something to do with the meaning of the line changing if the semicolon was on the end of the line, or on the next line. The statement was one that needed a semicolon. So to me it showed a big inconsistency.
new Rune data type (Score:3, Insightful)
I see language designers are still making the mistake of trying to represent characters as fixed size entities. Go 1 adds a new data type 'rune' intended to represent a UTF-32 codepoint, which is fine as long as it's only used for code points, but then the example code they show is:
:= '' // delta has type rune.
delta
var DELTA rune
DELTA = unicode.ToUpper(delta)
When you design an API that accepts or returns individual characters (as opposed to code units or code points), do not use rune, char, wchar_t, char16_t, char32_t, int, or any other fixed length type to represent a character. Characters are fundamentally variable length.
You should use a string data type because fixed size types can only represent a subset of characters. For example, a single UTF-32 code point cannot represent the Lithuanian characte LATIN SMALL LETTER A WITH OGONEK AND ACUTE. In Unicode this character can only be represented as a sequence of multiple code points (<U+0105> <U+0301> or <U+00E1> <U+0328> or <U+0061> <U+0328> <U+301>). So using strings works whereas using a fixed size type will inevitably fail.
Using strings to represent a character has another advantage beyond the fact that it's the only way that works. It eliminates the client's need to convert between the string type and the type used to hold a code point. Clients can just directly use text in whatever the native encoding is.
Re: (Score:2)
Q: What is a string?
A: A sequence of characters
Q: Ok, what is a character?
A: Well obviously, each character should be a string!
QED
Re: (Score:2)
Q: What is a string?
A: A sequence of codepoints
FTFY.
Re: (Score:3, Informative)
Possible replacement for Dalvik into the future? (Score:4, Interesting)
Does anyone know if this is an R&D project that could be poking at the idea of a litigation free runtime for Android away from Dalvik?
I'm curious to see how this language evolves and its internal adoption inside of google.
Regardless of the language taking off or not, it's a great to see a new language enter the ecosystem, and no doubt we'll learn things from it that can be brought back into main-stream languages or interesting innovation that could open the doors for new (pray disruptive) development in new areas.
Skynet, is that you? (Score:2)
Skynet, is that you?
Re: (Score:2)
Funny, though, I'll give you that.
Re: (Score:2)
Re: (Score:2)
Can you download it through the Go Network Utility Transfer System?
A work in progress (Score:2)
Fuego, North Korean Silver Star/KCC Igo, ZhiXing Chen's Handtalk, Michael Reiss's Go++, David Fotland's Many Faces of Go, GNU Go. Still nothing close to human.
http://en.wikipedia.org/wiki/Computer_Go [wikipedia.org]
Re: (Score:2)
Still nothing close to human.
I don't know what you mean by that. If it's performance, you don't make any mention of Zen. Try reading the "Recent results" section from your link. It's 6d on KGS (5d in slower games), and recently beat a pro with only 4 stones handicap.
Re: (Score:2)
ONLY 4 stones handicap? My grandmother could beat a pro with four stones handicap, and she was a Bridge player ; ).
Re: (Score:2)
Unless you're a dan player, a pro could probably spank your ass with 9 stones easily. Besides the pro game, 6d KGS is quite strong.
Re: (Score:3)
I don't see how C is elegant. It's a horrible pain to write a lot of modern code from across many disciplines in C and even C++. Most software that deals with hardware or UIs needs to process asynchronous events and producers/consumers, so you need state machines and yield at the very least. Those are almost universally a royal pain to hack around. Just look at the statechart and msm libraries in boost -- and that's C++, not C! In plain C, look at Miro Samek's QP framework. Both C and C++ gets you to drown
Re: (Score:2)
Hand written state machines can be written more easily and legibly in C than in just about any other language.
If you think that doing explicit double dispatch by hand is somehow legible or OK performance wise, then I've got a couple bridges to sell. The best C-style hierarchical state machine code will have potentially crippling overheads due to runtime traversal of state handler hierarchy. By overheads I mean that the handler traversals may take an order of magnitude longer than whatever the state handler did.
Things are somewhat broken if you can write state machines with less syntax and runtime overhead and in a
Re: (Score:3)
Last time I checked Googlers were limited to C++, Java, JS, and Python.
If you check now, you'll find out that the list is C++, Java, JS, Python and Go. In future, it may even be just C++, Java, JS and Go, judging from the trend at Google. (Specialties like Sawzall don't count here, I guess.)
Re:Pi is wrong on the main site (Score:4, Interesting)
This is interesting... If you run the Concurrent Pi example program on the Go website.. it prints:
3.1417926135957908
But it should be [uiuc.edu]:
3.1415926535897932
It's wrong starting with the 5th digit...
What kind of language is that inaccurate? And why would they use it as an example program?!
Re:Pi is wrong on the main site (Score:4, Informative)
As it mentions in the code, it's an approximation of pi using concurrency. The number of "goroutine" calls used determines the accuracy. In the code comments, they refer you to http://goo.gl/ZuTZM [goo.gl] if you want more information on the algorithm they are using. Increasing the accuracy is just a matter of increasing n in their example.
Re: (Score:2, Funny)
So, Go is a language best suited for quickly obtaining inaccurate answers? ~
Re: (Score:2)
In Google's example, the number of goroutine calls was 5000. In the link you posted, it was set to 300,000, and he got:
3.14159598691202
In other words, 2 additional accurate digits.
I get that this is supposed to show how Go handles a large number of concurrent processes (not to calculate pi).. but shouldn't it still be accurate? especially if you are making 300,000 calls and are only posting 15 digits of pi
Re: (Score:2)
but shouldn't it still be accurate? No. The imprecision has nothing to do with Go. It comes from the mathematical algorithm used to approximate pi.
Re: (Score:2)
interesting formula.. thanks for the link
Re: (Score:2)
You can use Go on Google App Engine: https://developers.google.com/appengine/docs/go/ [google.com]
Re: (Score:3)
First, Go has an FFI system like every other language. You can directly compile C code into your binary, and make wrappers with "cgo" for C and C++ libraries. Second, you should read this about dynamic linking -- I don't know if it's perfectly accurate but it's definitely interesting: What does dynamic linking and communism have got in common? [oracle.com]