Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
Software Google Programming Technology

Go, Google's New Open Source Programming Language 831

Many readers are sending in the news about Go, the new programming language Google has released as open source under a BSD license. The official Go site characterizes the language as simple, fast, safe, concurrent, and fun. A video illustrates just how fast compilation is: the entire language, 120K lines, compiles in under 10 sec. on a laptop. Ars Technica's writeup lays the stress on how C-like Go is in its roots, though it has plenty of modern ideas mixed in: "For example, there is a shorthand syntax for variable assignment that supports simple type inference. It also has anonymous function syntax that lets you use real closures. There are some Python-like features too, including array slices and a map type with constructor syntax that looks like Python's dictionary concept. ... One of the distinguishing characteristics of Go is its unusual type system. It eschews some typical object-oriented programming concepts such as inheritance. You can define struct types and then create methods for operating on them. You can also define interfaces, much like you can in Java. In Go, however, you don't manually specify which interface a class implements. ... Parallelism is emphasized in Go's design. The language introduces the concept of 'goroutines' which are executed concurrently. ... The language provides a 'channel' mechanism that can be used to safely pass data in and out of goroutines."
This discussion has been archived. No new comments can be posted.

Go, Google's New Open Source Programming Language

Comments Filter:
  • by sopssa ( 1498795 ) * <> on Wednesday November 11, 2009 @01:21AM (#30056494) Journal

    One of the things I immediatly noticed is the lack of build-in libraries. The reason I've always preferred Delphi and C# over C/C++ and PHP over Perl is that they all come with a comprehensive build-in function library for wide area of things.

    Programming now a days tend to be mostly high-level, so you would expect that new languages would provide that. I personally hate to find tons of different libraries for C++ projects just to do a basic thing. And lets be honest, theres no sense of everyone of us to code the basic functions again (and probably in worse code than the regularly checked build-in functions)

    That is why I love PHP, and because it provides a great manual on its functions. That is also why I love Delphi and why I started using it as 10 year old, without internet too - the reference guide that came with it was comprehensive and the build-in libraries and components for different things allowed me to rapidly try out to code apps and games. Only time I needed to find some libraries/components was when I was looking for a more rapid and better graphics library to do the drawing in my games.

    That is what would be "fun" in a programming language. It comes a lot before "fast builds, clean syntax, garbage collection, methods for any type, and run-time reflection."

    • by Blakey Rat ( 99501 ) on Wednesday November 11, 2009 @01:34AM (#30056570)

      Perhaps it's designed to be embedded, like LUA or Javascript? In that case, comprehensive libraries aren't necessary or even desirable.

      Or, more likely, they just did the fun part of designing the language, and are leaving the hard part of creating libraries to somebody else.

      • by DerekLyons ( 302214 ) <> on Wednesday November 11, 2009 @02:57AM (#30057082) Homepage

        Or, more likely, they just did the fun part of designing the language, and are leaving the hard part of creating libraries to somebody else.

        They pretty much explicitly state that in TFA - the 'simple' and 'fun' stuff is done, now it's up to the [currently theoretical] community to dig in and do the hard stuff.
        Of course, being Google branded and Open Source (two of the top 'auto orgasm' buttons among a huge swath of geeks) there will be, at least in the beginning, a fairly large community. I'll be very surprised if there isn't a Wiki by morning, and I'll be there's half a dozen or more Waves about it by now.

    • by Toonol ( 1057698 ) on Wednesday November 11, 2009 @01:37AM (#30056594)
      If they could at least include a subset of OpenGL... or just an SDL wrapper, maybe with some high-level features for simple 2d-3d manipulation... this looks like it would be a great learning language. I see they have a DRAW library with a very limited number of features.

      They also have a "spacewar" directory, currently empty...

      Whenever Google announces something, you have to make the decision... jump on it immediately and get ahead of the curve, but risk wasting all that time if it doesn't take off? Or wait?
    • Re: (Score:3, Insightful)

      by Al Dimond ( 792444 )

      PHP? Where they dump all their million built-in functions into one namespace? Lame. In Perl you have a lot more control over what libraries you pull in and how you use them -- you have to search CPAN for packages sometimes, but then you have a choice on what packages to use. And every Perl module I've pulled from CPAN has been well documented.

      I can see wanting lots of libraries around in a default install back before the Internet was big. These days that stuff should be separate and the language's core

    • Perl developers know about this thing called CPAN []. PHP doesn't even come close in this regard, and you really can't get a better language reference than perldoc []. Honestly, if you can't write an app using Perl's built-in functions and the thousands of modules from CPAN, you probably shouldn't be programming. While choice in languages can vary widely according to the individual coder's personal preferences and particular suitability for a given task, the weakness you've cited is imaginary.
    • by MemoryDragon ( 544441 ) on Wednesday November 11, 2009 @03:09AM (#30057142)

      Easy, make it compile java bytecode and you probably have the biggest library around on the planet. Why a language nowadays should provide its own libraries is beyond me. That is so 90s...

  • by Yvan256 ( 722131 ) on Wednesday November 11, 2009 @01:23AM (#30056500) Homepage Journal
    Go Go Google Language!
    • by reporter ( 666905 ) on Wednesday November 11, 2009 @02:50AM (#30057048) Homepage
      Ars Technica writes, "A video illustrates just how fast compilation is: the entire language, 120K lines, compiles in under 10 sec. on a laptop."

      If this language becomes as popular as Perl, then 120,000 lines will soon become 1,200,000 lines. That is exactly what happened to the Perl interpreter and compiler.

      Also, just like Java, the new Go language (due to the immense respect for Google's scientific prowess) will likely receive accolades: "it is the best, final language that we will ever need". The same was said for Java. It was sold as the ultimate final language built on 50 years of accumulated knowledge of language design and computer architecture. Upon the introduction of Java, company after company blindly adopted it.

      Was Java the final language satisfying humankind's computing needs? No. Was adopting it worth the cost? Maybe.

      Now, we have Go. Is it a massive improvement over C and Java, thus justifying spending milions of dollars to train programmers? Only the future will tell.

  • by Yvan256 ( 722131 ) on Wednesday November 11, 2009 @01:26AM (#30056514) Homepage Journal

    Go compilers support two operating systems (Linux, Mac OS X) and three instruction sets.

    Can somebody call hell to see if they can host the next Winter Olympics?

  • by cptnapalm ( 120276 ) on Wednesday November 11, 2009 @01:29AM (#30056532)

    Not having much luck. It can't find /etc/passwd, /etc/group or /etc/hosts. All of which do exist. I'm inserting fmt.Fprintf statements to attempt to figure out why it is having problems.

    A novel idea: make people learn Go by requiring them to modify it in order to install it.

  • by sshore ( 50665 ) on Wednesday November 11, 2009 @01:30AM (#30056542)

    It's a small complaint, I'm sure.. but couldn't they have given it a name that you could, you know, Google?

  • fmt (Score:5, Insightful)

    by Duradin ( 1261418 ) on Wednesday November 11, 2009 @01:32AM (#30056554)

    Vowels aren't nearly as expensive as they used to be back in the day.

    It'd be a nice touch if they'd add vowel support in package names.

    • Re: (Score:3, Insightful)

      by rrohbeck ( 944847 )

      I definitely prefer programming languages with concise syntax and function names. We don't need another Java.
      Maybe someone can write a preprocessor for the folks that want to bang out source by the megabyte.

      • Re:fmt (Score:5, Insightful)

        by Jonboy X ( 319895 ) <jonathan DOT oex ... DOT wpi DOT edu> on Wednesday November 11, 2009 @03:38AM (#30057282) Journal

        People will read a piece of code more times than they will write it, so it makes sense to optimize for readability. Besides, I end up autocompleting most type/method names in the IDE anyway.

        • People will read a piece of code more times than they will write it, so it makes sense to optimize for readability.

          If you can make the code 1% more readable (pick your measure) at the cost of making it take twice as long to write, is that worth it?

          If you can make the code 1% less readable and simultaneously make it twice as fast to write, is that worth it?

          Also, it's a particular name we're talking about. Is python unreadable because it says "len" instead of "length"? Is it bad to say "IndexError" instead of "ArrayIndexOutOfBoundsException"? Is it bad to say "" instead of "System.out."?

          Of all things, I think names (with vs. without vowels) have the smallest impact on readability. Descriptive names are important, but I think it's much more important to be able to write code that has an easily comprehensible structure.

          • by miro f ( 944325 ) on Wednesday November 11, 2009 @06:15AM (#30058034)

            I find that if you shorten long words arbitrarily, it actually increases the writing time.

            I could write ConnectionManager pretty quickly just due to typing experience in English. The words just flow from my brain onto the keys without even thinking about the individual letters. But if you shortened to CnnctnMgr then you have to think about it every time you type it out, what letters have I taken out again?

            It gets more difficult when you're working off someone else's code. If you shorten long words but not short words then later on when you're looking at new code it takes much longer to get used to variable names. If you stick to a convention and don't shorten any words, you sometimes don't even need to see the variable being used to know what it's called, and can use them without thought.

            ArrayIndexOutOfBoundsException is clearly a poor joke, however. I always hated that one.

          • by iris-n ( 1276146 ) on Wednesday November 11, 2009 @09:41AM (#30059268)

            Bad example. "len" was chosen to stop people typing "lenght", not to be shorter.

  • by martin-boundary ( 547041 ) on Wednesday November 11, 2009 @01:44AM (#30056646)
    I don't think so. I have an old Thinkpad 701C laptop which ain't compilin' this in under 10 seconds, if at all.
  • Not actually safe (Score:3, Interesting)

    by jfjfjdk ( 1260722 ) on Wednesday November 11, 2009 @01:44AM (#30056648)
    From a brief review of the language and implementation, this doesn't appear to use what we've learned about correctness over the last thirty years. Buffer overflows are just one bug class among dozens, and if you're going to create a language from scratch, why let integers overflow without making people explicitly request that behavior? Why ignore what we've learned about verification and formal languages? Microsoft has actually been far more responsible about this recently, thanks to the Java people they hired (Rustan etc); see Spec# [] for details.
  • by Culture20 ( 968837 ) on Wednesday November 11, 2009 @01:44AM (#30056652)
    This bodes well.
  • "Systems" language? (Score:5, Interesting)

    by TopSpin ( 753 ) * on Wednesday November 11, 2009 @01:50AM (#30056700) Journal

    They're billing Go as a "systems language." If by "system" they mean "application server in a Google data center" then I suppose that's correct. Previously the term "systems language" referred to languages suitable for operation system implementation, including device drivers, virtual memory management and other persnickety low-level software. Lack of pointer arithmetic and explicit memory management probably precludes any attempt to use Go as a "systems" language by that definition (although there are exceptions [] to that thinking.)

    There is too much competition from other fresh and well regarded "new" languages for yet another new entrant to gain much headway without something really novel to attract attention. Not that trying is bad; by all means keep at it. Can't afford the mental bandwidth to jump on more new bandwagons, however.

    • Re: (Score:3, Interesting)

      Lack of pointer arithmetic and explicit memory management probably precludes any attempt to use Go as a "systems" language by that definition (although there are exceptions [] to that thinking.)

      inferno is another exception to your definition of systems language. much of it is written in limbo, a direct ancestor of go. it too has automatic memory management and no pointer arithmatic and it works just fine [] []

    • by Animats ( 122034 ) on Wednesday November 11, 2009 @02:41AM (#30056990) Homepage

      Actually, you don't need pointer arithmetic for a "systems language". Neither Ada nor the Modula family had it, and those languages have been run on bare machines with no other OS underneath. You need the ability to explicitly place arrays in memory as a form of privileged hardware access, but it's not something that's used in most code.

      Garbage collection, though, implies there's a layer of software underneath your code. Garbage collectors either freeze the whole program, or need some help from the MMU to track pages altered while the collector is running. Hard real time and reference counts do not play well together. Reference counted systems don't inherently have that problem, and if the compiler optimizes out reference count updates they can be efficient. But most reference counted systems are slow and dumb.

      It's sad to see yet another C++ alternative that can't actually replace C++. We need a C++ replacement. C++ has stagnated. C++ is the only major language to have hiding ("abstraction") without memory safety, a bad combination never tried again. Strostrup is in denial about this being a problem, and the C++ standards committee is of in template la-la land, fussing over features few care about and fewer will use correctly.

      The previous poster is right, though. This is a language for writing applications to run on servers. Google needs something less painful than C++ and faster than Python. (Python is a reasonably good language held back by an archaic naive-interpreter implementation. Making Python fast is hard, though, because the compiler has to do type inference to figure out the variable type information the user isn't asked to provide. ShedSkin shows that can work, but that project only has one person on it.)

      • by ClosedSource ( 238333 ) on Wednesday November 11, 2009 @02:58AM (#30057090)

        "Neither Ada nor the Modula family had it, and those languages have been run on bare machines with no other OS underneath"

        Or customers above either.

      • Re: (Score:3, Informative)

        by Vintermann ( 400722 )

        You can get pointer arithmetic in Ada, as long as you sign the proper disclaimer of warranty forms and send them to the DOD in triplicate.

        Seriously, you can get pretty much anything in Ada, it's just that you need to be very, very verbose about the things you really shouldn't be asking for.

      • Re: (Score:3, Interesting)

        by ardor ( 673957 )

        You cannot shoehorn a GC into C++. Explicit memory management is so tightly coupled to C++ that most attempts at introducing something automatic automatically impose significant restrictions on what you can do. This is OK for specific scenarios, not OK for a core language component.

        Also, generic programming and template metaprogramming are one distinct advantages of C++ over other languages. The ability to metaprogram and use structural typing there is priceless, and some forms of metaprogramming are quite

  • by upuv ( 1201447 ) on Wednesday November 11, 2009 @02:05AM (#30056796) Journal

    I've been around for a long time.

    C great language did exactly what it was designed to do. But carries a lot of burden.
    C++ come on it didn't even have a string class. Thus pointer math hell.
    C#, Ok it learned a lesson and found the joy of a string class. But really it's a windows only lang.
    Java. Excuse me web apps that take 8Gig of ram spread across a farm of servers. This slow elephant remade the hardware business.

    All of the above never really understood concurrent / multithread / parallel. ( Sorry Java devs still have issues with the concept. GC & log4j come to mind as things that forgot they were in a threaded env. )

    So the "Go" lang it just might deserve a look. Clearly web centric. Clearly built for tons of concurrent comms. Recompiles in a blip thus useful for real time compiling alla jsp. I'm very performance centric. If I can replace my J2EE bloat ware with a trunk full of tiny Go apps I will.

    I'm definitely watching this space for developments.

  • by pslam ( 97660 ) on Wednesday November 11, 2009 @02:15AM (#30056846) Homepage Journal

    Go has garbage collection and lacks pointer arithmetic. So... it won't replace C++, then?

    Why was that so easy and quick to say? I really don't understand the repeated banging-head-against-wall that language inventors are doing. There's a good reason why C++ is still in wide and very popular use: precisely because it does have explicit memory management and pointer arithmetic. C++ is a static, explicit language. Go is not. It will not replace C++, and no language will until that is understood.

    The problems C++ need fixing are elsewhere. The syntax needs cleaning up. The ABI needs rationalizing between architectures. Multiple inheritance needs some taming (ditch 'virtual' multiple inheritance - it's insane), but not removing. Interface-only classes need promoting to a full type rather than inferred from being 100% pure virtual (and even then there's usually a non-pure-virtual destructor for stupid foot-bullet-avoiding reasons). There needs to be saner syntactic sugar for repeated operations (like python's 'with' keyword). Templates syntax needs to be less verbose and more automatic (already being worked on for C++0x but at this rate will be C++1x, keyword 'auto').

    Stop trying to replace C++ with a language that does not fulfill every aspect C++ covers. If you ARE a language inventor and reading my comment, answer this: can you write a cache/MMU interface or an interrupt handler in your language? If the answer is no, go back to the drawing board.

    • by TheTurtlesMoves ( 1442727 ) on Wednesday November 11, 2009 @04:38AM (#30057574)

      If you ARE a language inventor and reading my comment, answer this: can you write a cache/MMU interface or an interrupt handler in your language? If the answer is no, go back to the drawing board.

      Because if you can't do that then you can't do anything right?

      Heres a novel idea. Use a language as a tool, and use the right tool for the job. If you are writing an OS perhaps you need *explicit* access to pointers, or if you are doing something with MMU you would need a asm{} section (thats not C++ either). But when i want to write a application server then that requirement is lame and garbage collection and better memory models frees the developer and compiler (escape analysis etc) to do a lot more of the relevant work.

      We are not all writing an OS, so why the hell do we all need to be using a language that can write an OS? Just like all welders are not all welding Aluminum so they don't all need fancy TiG welders (just like we don't always need to use car analogies).

    • Re: (Score:3, Insightful)

      by bbn ( 172659 )

      If you ARE a language inventor and reading my comment, answer this: can you write a cache/MMU interface or an interrupt handler in your language? If the answer is no, go back to the drawing board.

      So there is zero assembler code in the Linux kernel because C can do it all? Not so.

      You do not need explicit memory management or pointer arithmetic to do these things. To write a device driver you might need the ability to access memory directly, but that could easily be done by mapping the memory region to an array.

      There are incremental garbage collectors that guarantee real time performance.

      It would probably be a huge benefit if the OS was written in a better language than C. One that takes a whole host

    • Re: (Score:3, Insightful)

      by rusty ( 3244 )

      > Stop trying to replace C++ with a language that does not fulfill every aspect C++ covers.

      Err, no (how did this get +5?) C++'s entire problem stems from the attempt to Be All Things. A far better approach is to design something that does one part of things well, and interoperates with C like everything else so you can glue stuff together.

      They've subtracted, not added. This is the Right Thing to have done.


  • by cgenman ( 325138 ) on Wednesday November 11, 2009 @02:26AM (#30056902) Homepage

    Despite the large amount of enthusiasm for language design, modern mainstream programming languages don't fall far from the C tree.

    Perhaps, like Qwerty, our C-based languages have evolved to be "good enough" for programming needs for the foreseeable future. Make objects, make functions, operate between the two.. sure DVORAK might provide 20% faster typing if you work at it for 3 years, but that's not really enough to warrant the switch. We're unlikely to see a jump again of the size from C to C++ before we hit a major structural change. I had thought the web might be that structural change, but that was well absorbed by extending existing ideas.

    Personally, I just want to see programming languages that are more programmer fault-tolerant. I can type "pizza" into my phone and have Chuck-E-Cheese offer to bake one while I drive over, but if I accidentally type "plaeyrArray" instead of "playerArray," the whole world is clearly on fire and everyone is going to die. Why can't compilers be more intelligent about the types of errors they encounter in routine usage? For that matter, why are we still defining code chunks via brackets instead of the indentation that's already there?

    • by Toonol ( 1057698 ) on Wednesday November 11, 2009 @03:34AM (#30057256)
      why are we still defining code chunks via brackets instead of the indentation that's already there?

      Because enforcing strict rules about indenting and how it's interpreted is more oppressive and error-prone than using brackets? I agree with your FIRST paragraph...
    • by Imagix ( 695350 ) on Wednesday November 11, 2009 @04:58AM (#30057680)

      For that matter, why are we still defining code chunks via brackets instead of the indentation that's already there?

      Are you insane? Have you ever written a parser? And being dependent on particular whitespace is really asking for trouble. Now, are those tabs or spaces? How many spaces? One of the earlier languages had position dependent coding (code had to start on column 3 or something like that. The name eludes me at the moment).

      • Are you insane? Have you ever written a parser?

        I've written my share. And I've read (and, I think, understood) how python does it.

        Really, it's not that bad. Simply look at each line and see if it's indented more than the previous; if so, add an OPEN_BRACE token; if less, a CLOSE_BRACE token (or call them OPEN/CLOSE, BEGIN/END, etc.). Then, once you've transformed the indentation structure into tokens, parse the rest.

        You can probably do it faster if you do it on the fly (i.e. at the same time as "parse the rest") rather than in two passes, but the ide

  • by Tablizer ( 95088 ) on Wednesday November 11, 2009 @02:32AM (#30056940) Journal

    Joy, yet another programming language :-) Programming languages are personal. We all have our favorite way to do things and most of the choices are subjective preferences. At we played around with the idea of a Build-To-Order form to generate a compiler/interpreter for a language with the combination of features you ask for. Below is a rough re-creation of the form:


    (Features in each group are mutually-exclusive if they have round brackets, but not if square brackets. )

    Compile Level

    * (__) Compiled: product of language targeted to direct run by a machine (possibly a virtual machine) or operating system.
    * (__) Interpreted: language is processed as data by a process called an interpreter, especially in some sort of ReadEvalPrintLoop. May support a hidden JustInTimeCompilation, but that should be considered an implementation detail rather than a language detail.
    * (__) Both but select on Program: language allows programs to be written for scripting or written for compilation, but programs written for compilation might not work for interpretation (e.g. due to late-binding dependencies) and programs written for interpretation might not work for compilation (e.g. due to top-level commands). This provides a lot of flexibility. However, it also partitions the user community because sharing will be difficult.
    * (__) Both for any Program: language ensures that every program is suitable for both compilation and interpretation. Supporting interpretation requires abandoning a model of external linking and requires ensuring the syntax is suitable for one-pass reading (i.e. preprocessors are a bad thing). Suitability for compilation implies abandoning (or at least distinguishing) imperative commands at the toplevel: those that are to be executed at compile-time vs. those that are to be executed at runtime.

    Model for Linking and Modularity

    * (__) No Linking: product is always fully declared from a single page or file. No linking occurs. There is no model for modularity. Many EsotericProgrammingLanguages have this model. Support for CompileTimeResolution may provide an interesting workaround.
    * (__) Includes: product may 'include' other pages, which are linked in place. There might be a system to selectively avoid duplicate includes. All pages are effectively parsed with each compile or execution.
    * (__) Single Page, Modular: language semantics allow 'importing' or 'loading' of other components. Allows useful optimizations such as compilation of components... or at least preprocessing and pre-parsing, of language components, because the semantics of the 'import' are held independent of the page into which it was imported.
    * (__) External Linking: a linker can combine a product by pulling multiple components together, but does so from outside the language. This model is incompatible with interpretation, and offers no real benefits over the 'Single Page, Modular' model except that it can be hacked into a language that doesn't have a concept of modularity (as was done for CeeLanguage).

    Modularity and Linkage Features

    * [__] Resolution of Circular Dependencies: the language or linker will correctly handle circular dependencies, ideally with minimal reliance on forward declarations.
    * [__] Provisionals and Overrides: the language allows you to override global objects, values, or procedure that are declared in other modules in a manner such that those other modules use the overrides, too. Ideal form would be as though they had always used the override, but this ideal form is somewhat difficult to reconcile this feature with interpretation.
    * [__] Inverted Constructs: one can automatically bui

    • It's simple. It's a lot of fun to design and even implement your own programming language. It is not too hard, depending on how big of a problem you choose to bite off with your language. And then there are the oohs and ahhs you get from other developers when you have implemented a language, especially if it compiles to some real or virtual architecture.

      Too bad learning to use a programming language effectively is a lot of work, and is usually pretty frustrating. It has been easy for me to find the time and

      • Re: (Score:3, Insightful)

        by shaitand ( 626655 )

        "is mainly why I don't run Gentoo"

        Fascinating. Personally I don't run Gentoo because compiling the entire system takes more extra time than the added performance saves me over the life of the install.

  • by FrankDrebin ( 238464 ) on Wednesday November 11, 2009 @02:46AM (#30057018) Homepage
    $ cat hello.go
    package main

    import "fmt"

    func main() {
    fmt.Printf("hello, world\n")
    Size of resulting binary: 581054 bytes on x86 Linux.
  • by qw0ntum ( 831414 ) on Wednesday November 11, 2009 @02:49AM (#30057042) Journal
    This fellow has been working on his own programming language, also called "Go", for a decade. Even released a book about it. He filed an issue in the tracker for the Google language: []
  • Skeptical thoughts (Score:3, Insightful)

    by jma05 ( 897351 ) on Wednesday November 11, 2009 @03:44AM (#30057308)

    I watched the presentation. It was about time for Google to join the programming language space, but I was not impressed as much as I had been with other Google projects.

    Go is fast: Sure. But compared to what? C and C++? They were never known to be fast compiling languages. Go is still a very simple language. So compilation speed is not impressive, relevant or novel *yet*. I recall from my Pascal (Delphi) days of how blazingly fast the compilations were when the language did not have a pre-processor or generics and had a more strict type system. Once Go gets generics and exceptions, we can see how well it compares to similar modern languages.

    Go is safe: I somehow kept seeing OCaml in a C style syntax in all this despite Go not being functional (perhaps I am just sleepy :-) ). Better type system, garbage collection, optional typing, higher data types. Imperative Ocaml also only takes a minor performance hit compared to C despite providing a much safer language.

    Concurrency: This could be something. The languages with built in support for this are somewhat obscure ATM (Erlang). Hopefully, Go will be more palatable to the mainstream.

    Programming languages are finally more than grammars and compilers. Many excellent languages never make it to limelight. C and C++ continue to be first choice for system software despite the existence of several excellent "language" alternatives. Google brand may help Go with an early boost, but it will be the tools, libraries and the community that will have to deliver it; or we will just have another Java FXScript story in front of us.

  • FYI: Array slices (Score:4, Insightful)

    by UnderCoverPenguin ( 1001627 ) on Wednesday November 11, 2009 @03:45AM (#30057310)

    Array slices and mapping types have been around for decades. Not even Perl was the first to provide tham, et alone Python.

  • gofmt (Score:5, Funny)

    by CharlyFoxtrot ( 1607527 ) on Wednesday November 11, 2009 @05:08AM (#30057728)

    From [] : "With Go we take an unusual approach and let the machine take care of most formatting issues. A program, gofmt, reads a Go program and emits the source in a standard style of indentation and vertical alignment, retaining and if necessary reformatting comments. [...] We use tabs for indentation and gofmt emits them by default. Use spaces only if you must."

    Of course you realize ... this means war.

  • Not Invented Here (Score:3, Interesting)

    by nut ( 19435 ) on Wednesday November 11, 2009 @05:26AM (#30057806) Homepage

    Google is developing a real, 'Not Invented Here' complex. Rather than get behind Firefox, they produce their own browser. Rather than integrate tightly with OpenOffice, they produce Google Apps. Now they've written their own programming language. Go figure. And of course there's always those rumours of the Google OS...

    • Er...? (Score:3, Informative)

      by Kupfernigk ( 1190345 )
      Chrome is based on Webkit and optimised for Javascript, which is Google's delivery tool of choice. OOO was never going to be suitable for running as a cloud application. The Google OS seems to be tight integration of Linux and Chrome. Go seems to be basically the start of an improved version of C, rather than an improved version of C++.

      You seem to be complaining because Google is working on technologies which are not your technology of choice. But far from an NIH, they seem to be giving serious traction to

  • by master_p ( 608214 ) on Wednesday November 11, 2009 @06:29AM (#30058120)

    Templates is one of C++'s advantage over any other language (except D that implements them). Without templates, type safe containers and reusable algorithms cannot be implemented. For example, in Go, a List class would have to use void* types, throwing type safety out of the window.

    The syntax is also not that good. That the type goes after the variable name, the missing parentheses in 'if' and 'for' statements are syntactic changes that offer no better readability over C.

    Finally, the built-in channel mechanism is something that can be done in C++ in less than 100 lines of code.

    • by daid303 ( 843777 ) on Wednesday November 11, 2009 @07:16AM (#30058348)

      ../test.cpp: In destructor ‘std::pair::~pair()’: /usr/include/c++/4.3/bits/stl_pair.h:73: instantiated from ‘void __gnu_cxx::new_allocator::destroy(_Tp*) [with _Tp = std::pair]’ /usr/include/c++/4.3/bits/stl_tree.h:390: instantiated from ‘void std::_Rb_tree::_M_destroy_node(std::_Rb_tree_node*) [with _Key = int, _Val = std::pair, _KeyOfValue = std::_Select1st >, _Compare = std::less, _Alloc = std::allocator >]’ /usr/include/c++/4.3/bits/stl_tree.h:943: instantiated from ‘void std::_Rb_tree::_M_erase(std::_Rb_tree_node*) [with _Key = int, _Val = std::pair, _KeyOfValue = std::_Select1st >, _Compare = std::less, _Alloc = std::allocator >]’ /usr/include/c++/4.3/bits/stl_tree.h:585: instantiated from ‘std::_Rb_tree::~_Rb_tree() [with _Key = int, _Val = std::pair, _KeyOfValue = std::_Select1st >, _Compare = std::less, _Alloc = std::allocator >]’ /usr/include/c++/4.3/bits/stl_map.h:92: instantiated from here ../test.cpp:11: error: ‘testObj::~testObj()’ is private /usr/include/c++/4.3/bits/stl_pair.h:73: error: within this context /usr/include/c++/4.3/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator::destroy(_Tp*) [with _Tp = std::pair]’: /usr/include/c++/4.3/ext/new_allocator.h:118: note: synthesized method ‘std::pair::~pair()’ first required here

      Because templates are wonderful!

    • by flithm ( 756019 ) on Wednesday November 11, 2009 @08:48AM (#30058884) Homepage

      C++'s templates offer a lot more than just generics (which is what you're talking about when you say "type safe containers and reusable algorithms"), however Go does, in fact, provide for this with its "interfaces." The Go interface affords for both data abstraction (akin to C++'s inheritance hierarchy), and generic programming. Go provides an "Any" container, which "may be used to implement generic programming similar to templates in C++ []".

      It's worth noting though that this is a dynamically bound language feature, which means it is checked and enforced at runtime rather than compile time -- both a positive and a negative depending on how you look at it. It provides for some more interesting programs to be written that do fun things at runtime, but on the down side it means you lose a lot of the compile time type-checking that C++ provides and can save a lot of debugging time later on. It also means that you can't do any template metaprogramming with Go -- again which can be viewed as a positive or a negative.

      I also challenge you to come up with a solution that equates to Go's built in Channel's in less than 100 lines of C++. What you're actually saying is you "can implement Go's Goroutine's AND Channels in less than 100 lines of code in portable, cross platform, C++". But, let's give you the benefit of the doubt and say that you've already go some mechanism for emulating a Goroutine (which by the way allows one to "mutiplex independently executing functions onto a set of threads"). I think _just_ the thread safe code that would implement all the necessary locks and barriers for a _single_ platform would probably be more than 100 lines, and would not be portable (ie, it would be pthreads, or win32 specific).

      I am open to being wrong about that, but I really do believe that you haven't spent much time investigating Go, and are therefore spreading FUD. For example your assertion that "in Go, a List class would have to use void* types, throwing type safety out of the window" is just plain wrong.

      I should also point out that I am in no way a Google Go fanboy. I see it as a pseudo-interesting low-ish level language that I haven't quite been able to envision the proper use for yet. I don't really buy Google's claim that it's a system level language (I can't see myself wanting to write an OS or device driver in it). To me it seems more like a great way to rapidly build efficient client / server type applications.

  • by RzUpAnmsCwrds ( 262647 ) on Wednesday November 11, 2009 @08:08AM (#30058632)

    Go seems to suffer from the problem of not being done. Case in point: exceptions.

    Google's C++ style guide [] forbids exceptions. This is because of historical reasons - Google's codebase is not exception-tolerant.

    Because Go doesn't have exceptions, programmers won't write exception-safe code. Since Go is garbage-collected, this is less of an issue compared with C++, but there are still cases where things like file handles or external resources need to be cleaned up.

    Two, three, or four years down the road, it's going to be hard to use exceptions in Go, because the existing code that's out there won't inter-operate properly with code that throws exceptions.

    In my opinion, exceptions are absolutely, positively critical in a modern imparative programming language. Exceptional conditions happen. Parsers get data in the wrong format. Network requests time out. Hardware fails.

    There are some exceptional conditions that should never happen, and if they do they should kill the system and print something that lets you track down the problem. Exceptions provide this behavior for free; simply don't catch them and you get at least a stack trace when they occur.

    The alternative is to write a bunch of error handling code to print out debugging information and exit. Then you call it from everywhere that one of these critical errors occurs.

    Except, what if you want to handle one of these critical errors? What if you're calling code that exits if it fails, but you want to report errors in a different way? What if the exceptional case is supposed to happen, like if you're writing unit tests?

    The other type of error isn't critical. Maybe it's a network timeout or a parsing error, neither of which should probably crash the system (in most cases). Here, you want to handle the error and take some action, like re-sending the data or asking for input from the user again.

    Error codes work here, except that they're cumbersome. Want to include information on exactly what kind of a parser error occurred? Now you're going to have to return both an error code and an error string. Maybe you'll even return an error object.

    What if the error occurs in a private method (lowercase first letter in Go) that's called by the public method (uppercase first letter in Go)? With exceptions, you just throw in the private method. With error codes, you need to check for an error code in the public method when you call the private method, then pass the error along.

    • by SlashDotDotDot ( 1356809 ) on Wednesday November 11, 2009 @04:08PM (#30064908) Journal

      Go seems to suffer from the problem of not being done. Case in point: exceptions.

      The authors at least partly agree with you. They describe the absence of exceptions here []. They consider it to be an open issue.

      On the other hand, they already provide an alternative to the "finally" block of an exception handler: the defer keyword []. I like the looks of this, as it means you can handle all of your closing and locking kinds of issues in a direct pairing with the corresponding open or lock, regardless of whether the function terminates early due to error conditions.

  • by jchandra ( 15040 ) on Wednesday November 11, 2009 @12:04PM (#30061192) Homepage

    Ken Thompson, who invented Unix, creates an experimental new language with Rob Pike et. al. and Slashdotters try to overdo each other in pissing all over it.


    Tell you what kids, try learning something for a change. And show some respect.

The only function of economic forecasting is to make astrology look respectable. -- John Kenneth Galbraith