News for hackers. Stuff that matters.
Re:Go 1.11 and Beyond by lederhosen on Saturday August 25, 2018 @05:15PM (#17842609)
If you value compile times (and you actually think generics make a difference, I do not) you would not make slices and hash tables generic like in Go, would you?

If you wanted a simpler language, you would not make slices and hash tables generic, would you?

If you wanted lower learning curve, you would not make special case generics would you?

If you wanted to wait, to get the perfect generic solution because a sub-optimal one is not good enough, you would not create a sub-optimal non-perfect temporal solution with special-cased generics for certain data types would you?

If you argue that I am loyal and not honest, and therefore like generics because it is used in my favorite language, I think you are wrong.

The languages I use most of the time have a huge design flaw. It is called null. But when they created Go they chose to (except in special cases) get rid of (useful) generics instead of the disaster that is null.

The problem is that Go has not learnt from other languages. It is too imperative, not expressive enough, lacking in static typing and horrible at fault handling.

Re:Go 1.11 and Beyond by foldr on Saturday August 25, 2018 @06:01PM (#17842823)
>(and you actually think generics make a difference, I do not)

It's pretty difficult for generics not to adversely affect compile times. This is especially so if you actually emit specialized code for each type.

Re:Go 1.11 and Beyond by coldtea on Saturday August 25, 2018 @09:23PM (#17843662)
>It's pretty difficult for generics not to adversely affect compile times.

Compared to what? Non having type-specific code?

Because if you manually write (or use code generation madness as some propose) that type specific code you need yourself, then the compiler will take the same time to compile it as if generics were a language feature.

Re:Go 1.11 and Beyond by foldr on Sunday August 26, 2018 @06:49AM (#17845290)
The compiler also has to generate the specialized code. But I suspect that the main factor here is just that the presence of generics in a language encourages the use of generic programming to an extent that wouldn't be practical in a language without generics. Take e.g. the boost geometry library (C++). Theoretically you could write a similarly generic library in Go using code generation, and it would probably take ages to build too. Of course, no-one would actually do this.
Re:Go 1.11 and Beyond by pjmlp on Sunday August 26, 2018 @03:25AM (#17844740)
I bet CLU generics as designed in 1971 hardware would compile quite fast on modern hardware.
Re:Go 1.11 and Beyond by foldr on Sunday August 26, 2018 @06:46AM (#17845281)
Maybe. I don't know. It is pretty difficult to find examples of languages with generics that have compile times comparable to those of Go.
Re:Go 1.11 and Beyond by pjmlp on Sunday August 26, 2018 @07:46AM (#17845481)
Easy, CLU (1971), ML (1973), Ada (1983), .NET (2003), Delphi (2007), D (2007).

Not every implementation needs to be turing complete C++ style.

Re:Go 1.11 and Beyond by foldr on Sunday August 26, 2018 @08:39AM (#17845680)
I don't know anything about CLU. ML compilers are a mixed bag. OCaml (which is a different dialect, of course), has an acceptably fast compiler, but it's not near-instant like Go. Ada compilers are famous for being slow, at least historically. C# is, again, acceptably quick to compile, but not as quick as Go. I don't know about D. I've heard good things about Delphi's compile times, but no-one uses it now.
Re:Go 1.11 and Beyond by pjmlp on Sunday August 26, 2018 @10:56AM (#17846180)
In that comparison you forgot the part of turning off optimizations so that the code quality is similar to what Go standard compiler spends time doing.

The compilation speed drop is easily seen when using gccgo instead.

A side note for Delphi, it is still relatively used in European enterprises, with an yearly conference in Germany.

And I could have mentioned other languages like Eiffel, with their mixed JIT for development and AOT via C compilers for final delivery.

Re:Go 1.11 and Beyond by foldr on Sunday August 26, 2018 @01:33PM (#17846852)
The Go compiler is still faster than most of the competition, even when you compare with optimizations turned off.
Re:Go 1.11 and Beyond by pjmlp on Sunday August 26, 2018 @02:19PM (#17847090)
So you hardly know the languages, never used some of them, but Go compiler is faster.

Very scientific.

Re:Go 1.11 and Beyond by foldr on Sunday August 26, 2018 @04:58PM (#17847874)
>So you hardly know the languages

No, I know all of the languages that you mentioned except CLU. And since I don't think there are even any practical CLU implementations available for modern hardware, I'm not sure how you are able to compare CLU compile times to Go compile times. Are you maintaining a legacy CLU codebase or something?

Now, if there are scientific comparisons available, I'll happily defer to those. But unless you spend inordinate amounts of your time comparing compile times between languages, I doubt that you have any scientific info to go on either.

Re:Go 1.11 and Beyond by pjmlp on Sunday August 26, 2018 @05:26PM (#17848013)
> I don't know about D. I've heard good things about Delphi's compile times

Doesn't look like actually knowing them to me.

> Are you maintaining a legacy CLU codebase or something?

No, just you are apparently stating that a CLU compiler developed to be usable in 1971 hardware will run slower than Go on 2018 hardware, which doesn't make much sense.

Talking numbers, D was taking 1.24s to compile its complete standard library in 2010, (too lazy to try out the latest version) including the piles of template code that it has.

https://digitalmars.com/d/archives/digitalmars/D/D_compilati...

Re:Go 1.11 and Beyond by foldr on Monday August 27, 2018 @08:35AM (#17851036)
> Talking numbers, D was taking 1.24s to compile its complete standard library in 2010, (too lazy to try out the latest version) including the piles of template code that it has.

I followed in the instructions for building Phobos on the wiki here at https://wiki.dlang.org/Building_under_Posix:

    real	0m12.269s
    user	0m12.896s
    sys	        0m2.150s
Quite a lot of that time appears to be spent linking. I wonder if the post on the mailing list was reporting the literal compile time, rather than the build time?

It was a bit difficult to find a go project of similar size that was easy to build. The backend component of limetext is about 10k LOC compared to 35k for Phobos. When I do a ‘time go build -o foo’ in go/src/github.com/limetext/backend, I get the following:

    real	0m0.163s
    user	0m0.140s
    sys	0m0.207s
Multiply that by 3 plus a bit to compensate for the LOC difference, and it's still pretty good.

Still no idea what you are on getting with regard to CLU. We don't have any info on how fast it compiled.