Hacker News new | past | comments | ask | show | jobs | submit login

> extremely fast compiles - you miss this when you go back to languages that compile more slowly. It allows for rapid prototyping and trying stuff out without having to worry about a massive build time.

You're paying a price for this speed: the Go compiler is single pass, which considerably cripples the language and imposes a lot of weird asymmetric features.

And the compilation difference is really still in the ballpark of Java or C#, so it should definitely not be a factor in your decision. Odd that it was a design goal for Pike and his team, but everything is Go seems to indicate that the last language they programmed seriously in was C++ in the late 90's.




> You're paying a price for this speed: the Go compiler is single pass, which considerably cripples the language and imposes a lot of weird asymmetric features.

That's just not true - go is not single pass (as I understand it). There are separate passes performed for top-level types and code blocks, for example, and you can forward reference all you like.

Actually, I've made a couple contributions to the language so have played with the internal implementation, and in fact the parse is done in one pass, setting up internal representations of the types/names/etc. before type-checking of top-level types is performed in a separate pass, then variable assignments, then function bodies. I can't see how this is single-pass, e.g. src/cmd/gc/lex.c:238:-

    // Process top-level declarations in three phases.
    // Phase 1: const, type, and names and types of funcs.
    //   This will gather all the information about types
    //   and methods but doesn't depend on any of it.
    // Phase 2: Variable assignments.
    //   To check interface assignments, depends on phase 1.
    // Phase 3: Function bodies.
    defercheckwidth();
    for(l=xtop; l; l=l->next)
        if(l->n->op != ODCL && l->n->op != OAS)
            typecheck(&l->n, Etop);
    for(l=xtop; l; l=l->next)
        if(l->n->op == ODCL || l->n->op == OAS)
            typecheck(&l->n, Etop);
    resumetypecopy();
    resumecheckwidth();
    for(l=xtop; l; l=l->next)
        if(l->n->op == ODCLFUNC)
            funccompile(l->n, 0);
    if(nerrors == 0)
        fninit(xtop);
    while(closures) {
        l = closures;
        closures = nil;
        for(; l; l=l->next)
            funccompile(l->n, 1);
    }
    dclchecks();
Unless I'm missing the point - what is crippled and where are the weird asymmetric features?

One thing that go avoids is weird syntactic conflicts which require big lexer/parser hacks to work around. C# has quite a few of those, e.g. Foo<Bar<Baz>>> - that's emphatically not the same thing as a single-pass compiler.

Actually Rob has talked about this[1] and highlights dependency management as the most important factor.

I use C# in my day job and find the go compiler considerably quicker, incidentally.

[1]:http://www.infoq.com/interviews/pike-google-go


> the Go compiler is single pass, which considerably cripples the language and imposes a lot of weird asymmetric features.

What evidence do you have that it cripples the language? And can you point to a single 'asymmetric feature' (whatever that means) caused by this?

If you read any of the interviews with Rob, he clearly points out that the compile speed has little to do with it being 'single pass', and all to do with the package system.

In my subjective experience the compiler is way faster than Java or C# compilers, and they still have plenty of room to optimize compiler speed (for example, there is plenty of stuff the compiler could do in parallel but at the moment doesn't because they have tried to keep the toolchain as simple as possible specially while the language is changing so fast.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: