377 points · by snewe · 17y ago · 218 comments
I'm actually happy! It means my stupid little language has some validity :P
For those who wish to deride it: http://code.google.com/p/prism/
I feel as if string and map simply could have been part of the standard library. My solution to the this for prism was to have a section of the standard library (which doesn't exist yet) marked as "integral", to effectively have an implicit "import string, map from std.__integral__" at the top of every translation unit.
The absence of overloading operators seems to contradict their claims of improving the visual "flow" and feel of programming. There are cases where savvy operator overloading works wonders: vectors/matrices/quaternions, strings, complex numbers, etc. To be able to write my_string + my_other_string is far more elegant than strcat(my_string, my_otherstring). Consider what happens when you have four of five strings you'd like to concatenate!
The choice of CSP reflects Google's mentality: Their problems lend themselves very well to CSP. Other domains (in my opinion) work better with a STM model. But that's clearly a design choice, and I think it's fine!
However, you can write "abc" + "def" in Go and it does what you expect.
It looks like C with some very carefully chosen additions: memory safety, concurrency and maps.
"Go is mostly in the C family (basic syntax), with significant input from the Pascal/Modula/Oberon family (declarations, packages), plus some ideas from languages inspired by Tony Hoare's CSP, such as Newsqueak and Limbo (concurrency). However, it is a new language across the board."
Two of the designers were Rob Pike and Ken Thompson, both instrumental developers of Unix/C and Plan9/Inferno. Thompson created the B programming language that C was based on.
I'm excited to see CSP in Go. I've been advocating its use for concurrency since I learned about Plan 9's channels, but most people paid no attention.
And the goal, as they mention, seems to have the efficiency of a statically-typed compiled language with the ease of programming of a dynamic language but with -
Safety: type-safe and memory-safe.
Good support for concurrency and communication.
Efficient, latency-free garbage collection.
High-speed compilation.
They are aiming at a lightweight type system with no implicit conversions and no more 0x80ULL.
A good starting point is their FAQ page and also the tech talk at youtube: http://www.youtube.com/watch?v=rKnDgT73v8s
> Any type that has the named methods [...] is said to implement the interface.
For instance, in the tutorial, the cat function takes a reader interface. fmt.Print and Println a type will output whatever its String() "method" output. This is what Python does, e.g. "print x" is eqv. to "print x.__str__()".
You're already marking up the code for humans using indentation, don't repeat yourself by having the compiler use a different parsing mechanism (and make developers mark up seperately for their colleagues and the compiler).
Wearing braces is optional. It's only the beards that are mandatory.
It says great things about Google that these all clearly started as projects that they assumed nobody would ever have to Google. (Although http://www.google.com/chrome is now #1 for [chrome]).
"package management for go programming language" or "XML parser go programming language" probably won't be so useful, and it is sure cumbersome to type.
Actually, in their case, I think it's more that they want to choose names are a mix between commonly-used word and one that is similar to an already existing product. Wordperfect --> Word, Netscape Navigator --> Explorer, OO.o XML --> OOXML, etc.
I'd expect: the game, then the language. Certainly not go.com
Now from the technical point of view, there are a few interesting points like the threading approach, but in general the language does not appear to provide great new ideas, nor to be a language where consolidated ideas are put together very elegantly.
It seems like that for system programming the "better C" that one could need is different than this, while for general programming what is really missing is something like Ruby and Python but made as fast as C and with low memory usage by mean of doing the right sacrifices to the language, but still retain most of the abstraction level.
Go is not as powerful as C++, not as high level as Java, not as raw as C for low level stuff. I don't like it.
Go is exactly what you're asking for in your third paragraph -- it seems you were blinded by the curly braces...
Go is simple and fast. It has garbage collection, it facilitates parallel programming and it does away with lots of useless OO cruft. At first sight I like it.
hg log --rev 0:4 --template '{date|isodate}\t{author}\n\t\t\t\t{desc|firstline}\n\n'
1972-07-18 19:05 -0500 Brian Kernighan <bwk>
hello, world
1974-01-20 01:02 -0400 Brian Kernighan <bwk>
convert to C
1988-04-01 02:02 -0500 Brian Kernighan <research!bwk>
convert to Draft-Proposed ANSI C
1988-04-01 02:03 -0500 Brian Kernighan <bwk@research.att.com>
last-minute fix: convert to ANSI C
2008-03-02 20:47 -0800 Robert Griesemer <gri@golang.org>
Go spec starting point.Annoyances: braces; variable declarations more verbose than in C
Flaws: no discriminated unions; no generics or parametric polymorphism
Doubts: no exceptions; no macros (as far as I can tell)
Edit: I take back the verbosity claim. := does inference
Edit2: interfaces replace generics, but are
type-checked at runtime, apparently:
http://golang.org/doc/go_for_cpp_programmers.html#InterfacesI am not sure why I'd use this language with no libraries when I could use a better-designed language with no libraries instead.
ch := make(chan int);
go sum(hugeArray, ch);
// ... do something else for a while
result := <-ch; // wait for, and retrieve, result
You can actually set up any complex mess you want of functions talking to other functions through channels. This gives you coroutines, threading, etc. Looking through the spec, it looks like they have anonymous functions and closures as well.While I agree that they need to add exceptions, they do have some interesting things in there already.
Generics are being worked on (according to the tech talk), but they haven't determined the best way to do them yet.
I like this not just because it's CSP reborn -- new languages should be introduced with their own delightful disambiguating nomenclature.
Best of all, no header files!
I did it with a horrible C++ preprocessor hack. It was fun.
http://arstechnica.com/open-source/news/2009/11/go-new-open-...
Hey, give MS some credit for F# here! And it's got out of the box support in Visual Studio 2010.
* Kathy Sierra
* JWZ
* ESR (okay he's a bad coder, but still)
* Zed
* _Why
* The MIT Introduction to Algorithms instructors who clearly spend time making their lectures entertaining as well as informative.
* And yeah, most of the staff at Ars:
DRY dictates not having seperate markup for the compiler and your colleagues - so yes, in that respect, the unnecessary braces in Go are not innovative.
Thanks for giving me something to do with all my free time for the next couple of weeks.
http://golang.org/doc/go_mem.html
If you do things via synchronized channel communication then it eliminates (mostly) the need to spend all your time with mutexes and the like because the channel sync does that work for you. At the beginning it'll probably take people time to get there heads around it, but my recollection was that it was a game changer once you understood how the synchronization worked.
Sorry if that's kind of specific, it's some of the limitations in one of the current problems I'm working on :)
Like I said earlier, there is significant interest inside Google to make it possible to write really low latency services in Go. I personally think 15 usec is reasonable to ask for.
The main quirk I see right now is that the syntax feels more like a shuffling of characters, rather than actually simplifying anything. For instance, they save parentheses in for loops (great idea!), yet suddenly I need a useless "func" before every function. It also seems like there needs to be a default type for arguments, either "int" or "string", for it to feel truly simplified.
A feature I would really, really like to see in a language is the notion of automatically printing lone strings, or automatically printf()-ing lone string format lists. It's a little irritating after all this time that one must "echo" or "print" or System.out.println() or fmf.Printf() everything (much less import standard libraries to do it), when it is such a common task.
After a quick glance, D piqued my interest more. D seems to fall a bit nearer to the C++ side of the fence than Java, but also boasts C++-level performance and relative safety.
http://www.ddj.com/hpc-high-performance-computing/217801225
Neither of them will replace C or C++ in the near-term simply because those languages are so entrenched, but if I were looking for a language just to play around in for potential future use from these families, at this point it'd be D.
Interesting so far besides some syntax ugliness and lack of macros, but not yet good enough for many system programming projects, especially given the state of the garbage collector. GC is the hardest thing to implement large-scale, concurrent, memory intensive applications (e.g, database servers). Java spent 18 years to perfect its GC to be the current state of the art, which still sucks for these applications.
I hope they can come up with a concurrent garbage collector that can work on > 16 GBs of RAM with sub ms max latency :)
Hopefully they can rip off the design of GHC's amazing parallel garbage collector (it runs in its own pthread), and ditch the current mark-and-sweep.
So now Google's got its own OS (two actually), browser, and now its own programming language. Anything missing yet? Their own editor / IDE?
They have at least three product OSes: ChromeOS, Android, and The Google Search Appliances.
This is at least their second new programming language project: there's also Rob Pike's Sawzall. They have numerous in-house implementations of existing programming languages: V8, Closure, GWT, Dalvik, Unladen Swallow, plus all the extant ones they maintain forks of.
P.S. No offense, but it's amazing how some people are such Google fans.
I wouldn't imagine this as something that they'd release.
I'd argue their secret sauce, and the parts they wouldn't want to release, are - the insane scaling stuff - all the intelligent things they do with the insane amount of data they have, and the insane rate at which they can process it
Also, I think the zero-prefix convention for octal literals is very confusing and possibly error-prone, but it seems to be used even in modern programming languages. Is there a good reason to keep using '0765' instead of something '0o765'?
I've been wanting this in C# for a while now. Maybe one day...
It's based upon the phrase: if it looks like a duck and quacks like a duck, it's a duck.
In this case, if the object has the methods of the duck interface, treat it like a duck object.
I've just been getting in to generic programming with C++ (Stepanov's new book, awesome). So the fact that they don't have templates or operator overloading (the two critical pieces to STL style) was a bit of a downer. That being said the interfaces concept reminded me of generic functions (in CLOS). Sounds pathetic but I probably will give it a try just because it's from Google -- but I'm quite skeptical. With the really interesting work going on with Haskell, Clojure, Fortress, etc. it seems a shame to stay so close to C.
What I mean is that Google always has to do things the Google way whether that's an improvement or not. Whether this turns out to be a valuable contribution to the field will play out over the next few years. We'll see. But a company that makes their own DB, their own phone, their own programming languages, etc. is pretty much a prototypical "not invented here" company.
Google has some unique problems, they also have a unique position in that they probably have pooled the largest number of IT talent world wide.
That gives them clout enough to do these things, just like Erlang came out of a phone company (why, couldn't they have used some existing language ?) and Apple made their own phone (I'm sure they could have afforded a Nokia or two) google can and does have the budget to branch out in other fields.
That's not 'NIH', NIH is doing something even though better alternatives exist, for instance, writing your own bookkeeping software when you're a mid-sized company and you should be spending your time on serving your customers instead of writing bookkeeping software.
Google even makes their own servers, at their levels of scale a lot of things that do not make sense for smaller companies actually improve the bottom line.
Google suffers from many defects, bad customer support would be the top of my list, but NIH isn't one of them, at least not in this case.
That's almost like accusing Xerox in their heyday of having NIH, and I'd hate to think what the world of software would look like today if it hadn't been for that.
(That's not a criticism—language design shouldn't always be in the revolutionary mode.)
Is it too simplistic to say that at one end you have expressive languages designed for humans and at the other you have low level languages designed for speed?
edit: not meaning to insult humans who like fast languages.
If anyone can bring about a tab reniassance, it's bwk, ken, rob, rsc, and gri. These titans wrote your operating systems and your programming languages. They all wrote their own editors (not sure about gri) -- hell, the Go tests use ed!
Tabs have been lost in the wilderness for too long, it is about time they are reborn!
what advantages this have over
import fmt
that a new language is choosing this sytax?
import fmt "fmt"
Where the quoted fmt is an import path. Not making it a string literal would create a potential clash between characters used in filesystem paths and the Go parser.
I do see the reason to design a language efficiently, but I emphatically disagree with optimizing away small numbers of characters. Typing is a basic skill for the job, and the overhead is dwarfed by the text of the program (not to mention that we're making everyone type braces and semicolons).
Sweet...
[edit: creepy thought... Go logo == the Glenda bunny being thrown at something?]
One could have extra information right beside each submitter/commenter's name (e.g., ... founder, Google employee, PhD in ..., etc.).
And, yes, it would amuse me for a couple of days if everyone with/working on a PhD were encouraged to append their thesis titles after their usernames.
* though yes, for people I don't recognise who are not posting particularly interesting comments, it does not matter who posted them. Such as this comment I assume, anyone could write it.
You later find out from his/her profile that this person is a Google employee and is in a position to know what he/she commented about. It might be too late by then to take back what you wrote.
EDIT: after watching some of the tech talk, it's evident that while Rob Pike is involved, it's not entirely his baby... He is however involved, and there are definitely ideas from newsqueak in the language.
It (go + native client) might become a next major platform. Just think about low-level (and easier to code than C[++]) Javascript alternative.
Google: what is the point? First it's browser plugins, then browsers, then two OS's, now programming languages? How about a nice new processor architecture a la PowerPC? It's better and faster you know. Maybe they'll also invent new people to be their user base. I can imagine that intro video: "Welcome to GPeople - the new Google interaction experience. When you interact with a GPerson you don't need to talk. They already know what you are thinking and will insert relevant advertisement into their conversation with you. The advertisement will be unobtrusive and will target your innermost fears..."
If you think that programming languages are a 'done deal' then try to ignore the last 15 years or so and see what you're left with.
Sure, we're not much closer to the holy grail of programming in absolute terms, but new languages (erlang, clojure, ruby, python to name a few) have definitely incrementally changed the perspective we have of programming, and have opened up more fruitful ways of building certain classes of applications.