Earlier quoted context omitted.
> I still just don't understand why they insist on building their own toolchain. It just doesn't make sense to me. To quote rsc from https://news.ycombinator.com/item?id=8817990 : "It's a small toolchain that we can keep in our heads and make arbitrary changes to, quickly and easily. Honestly, if we'd built on GCC or LLVM, we'd be moving so slowly I'd probably have left the project years ago." "For example, no standa…
Which is of course no answer at all. Their own explanation for wasting hundreds of thousands of man-hours on a "quirky and flawed" separate compiler, linker, assembler, runtime, and tools is because they absolutely needed an implementation detail that is completely invisible to programs and which they are now replacing because it wasn't a good idea in the first place (segmented stacks). And it's worth writing out a 1…
“This change deletes the C implementations of the Go compiler and assembler”
121–130 of 137 posts
Re: “This change deletes the C implementations of the Go compiler and assembler”
#122Earlier quoted context omitted.
I read somewhere (but I can't think of the keywords to find it now) that they found the greater flexibility in owning their toolchain was worth the cost. For example they changed their data layout for GC purposes and changed the segmented stack approach over the course of their development and had they been tied to LLVM or gcc they'd have spent much of their time fighting against those implementations, or politicing…
Are you thinking of this comment? https://news.ycombinator.com/item?id=8817990
Re: “This change deletes the C implementations of the Go compiler and assembler”
#123Earlier quoted context omitted.
I was impressed by the toolchain when I first peaked at Go because it was dead simple to get up and running on any platform, especially Windows. For gcc you have to deal with MinGW. Isn't LLVM just now getting to the point where it can build native Windows applications? This is one area where I hope Rust makes progress. MinGW/Msys2 is just kind of gross stuff to deal with.
Care to explain what's gross about MSYS2/MinGW-w64? I'm genuinely interested in making it less gross.
Installation of Go or Python is just like any other Windows install. You download an installer.exe or .msi, run it, and you're done. Things compile or run immediately, and you don't have to start using a "special" terminal just for it to work.
My experience with MinGW is very different. Especially for dependent languages. "Step 1: Install MinGW" what does that even MEAN?:
"Ok, I ran this installer, and it brought up the MinGW Installation Manager. Is it done? What am I supposed to do here? Which one do I choose? How do you even select a package? What even ARE packages? OK, so I select something then go the Package menu and select Mark for Installation. It's not doing anything. Is it done now? Close window. Nope that didn't work. Open it back up. Oh, so after marking a package I have to go to the Installation menu and choose Apply Changes. ..."
This actually happened to someone I was trying to help over the phone. Heaven forbid they get lost in All Packages and get confused by the dozens of packages each with half a dozen versions and each with three different, non-descriptive "classes".
Installation needs to be braindead simple. During installation it should show a list of extra languages that can be installed, where you can't uncheck 'base' (with an "Advanced Options" button in the corner that opens up the standard installation manager instead). It should set up any environment variables, including PATH, (and including restarting explorer to refresh the env) and it shouldn't require the use of any terminal other than cmd.exe (despite it being terrible).
If you're installing something else entirely that depends on MinGW, their installer should be able to bundle the MinGW installer, and it should install without having to make any choices. It should detect if MinGW is already installed and install packages there instead, still completely automated.
Make it go away.
Re: “This change deletes the C implementations of the Go compiler and assembler”
#124Earlier quoted context omitted.
Lightweight goroutines depend on small stacks. General API design in Go depends on lightweight goroutines. In particular, Go style is to never write asynchronous APIs. Always write synchronous blocking code, and when you need to work concurrently, create a goroutine. You cannot do this in C with pthread, because OS threads are too heavyweight. So you end up in callback-based APIs that are harder to use and harder to…
Threads and stacks are orthogonal. You can have coroutines with contiguous stacks, and threads with non-contiguous stacks. Furthermore it's extremely easy to use non-contiguous stacks in C just by knowing the stack amount used by functions, which the compiler already knows. This is a totally absurd reason to reimplement an entire toolchain.
If you came to me tomorrow and said "I want to build a language just like C but with non-contiguous stacks" I agree, I would use LLVM or GCC. But that's not what happened.
The history is three engineers decided to see if they could do better than C++ for what they did every day. That meant trying lots of things. One of the many was goroutines, but they needed a flexible platform on which to try lots of ideas that didn't make the final cut.
It just so happens, two of them had worked on a toolchain before. Ken's from Plan 9. (Which long predates the existence of LLVM.) And as he knew his compiler well, it was very easy to modify it to try these experiments.
In the end the language stabilized with several unusual features, several of which would be difficult to add to other compiler toolchains they were not familiar with. Is that the point they should switch to using LLVM?
Building on a toolchain you know that lets you experiment makes a lot of sense. Knowing a toolchain means you get to work quickly.
The end result still has useful features that LLVM does not. For example, running ./all.bash does three complete builds and runs all the tests. It takes about 60 seconds on my desktop. Last time I tried LLVM, it took minutes. Go programmers love fast compilers.
Re: “This change deletes the C implementations of the Go compiler and assembler”
#125Earlier quoted context omitted.
Threads and stacks are orthogonal. You can have coroutines with contiguous stacks, and threads with non-contiguous stacks. Furthermore it's extremely easy to use non-contiguous stacks in C just by knowing the stack amount used by functions, which the compiler already knows. This is a totally absurd reason to reimplement an entire toolchain.
I'm not sure what about my comment is worth downvoting, but to try one more time: If you came to me tomorrow and said "I want to build a language just like C but with non-contiguous stacks" I agree, I would use LLVM or GCC. But that's not what happened. The history is three engineers decided to see if they could do better than C++ for what they did every day. That meant trying lots of things. One of the many was goro…
Except that is exactly what happened. Russ says: "segmented stacks; we had to build that, so it was going to be incompatible from day one."
That's the rationalization though. It wasn't about features that you can all but do in plain ANSI C being 'too hard'. We all know what really happened is that they were comfortable with their Plan 9 toolchain and made a demo using it... which is fine. Then they continued to develop their demo for 5 years instead of throwing it out and doing it right, and now they are stuck having to make excuses for why their compiler and assembler and linker and runtime and tools are sub-par.
Re: “This change deletes the C implementations of the Go compiler and assembler”
#126Earlier quoted context omitted.
I'm not sure what about my comment is worth downvoting, but to try one more time: If you came to me tomorrow and said "I want to build a language just like C but with non-contiguous stacks" I agree, I would use LLVM or GCC. But that's not what happened. The history is three engineers decided to see if they could do better than C++ for what they did every day. That meant trying lots of things. One of the many was goro…
> If you came to me tomorrow and said "I want to build a language just like C but with non-contiguous stacks" I agree, I would use LLVM or GCC. But that's not what happened. Except that is exactly what happened. Russ says: "segmented stacks; we had to build that, so it was going to be incompatible from day one." That's the rationalization though. It wasn't about features that you can all but do in plain ANSI C being…
And now it is written in Go, the preferred language of the compiler engineers.
Re: “This change deletes the C implementations of the Go compiler and assembler”
#127Earlier quoted context omitted.
I was impressed by the toolchain when I first peaked at Go because it was dead simple to get up and running on any platform, especially Windows. For gcc you have to deal with MinGW. Isn't LLVM just now getting to the point where it can build native Windows applications? This is one area where I hope Rust makes progress. MinGW/Msys2 is just kind of gross stuff to deal with.
Care to explain what's gross about MSYS2/MinGW-w64? I'm genuinely interested in making it less gross.
Part of the issue with most software that uses MinGW is that it is written with posix-y operating system in mind. That is, operating systems that can very efficiently fork processes and quickly deal with many small files. Unfortunately, Windows does neither well. Process creation is slower, and NTFS is a very lock-happy filesystem.
Why do I consider this gross as a user? Things like Git that utilize msys are slow on Windows. As in, I notice the UI hanging. Things like autoconf are terribly slow on Windows due to all of the small processes that are created to detect the environment. Antivirus tools will lock files that are created and generally slow things down due to the nature of lots of quick-running processes creating and deleting small files.
These are just realities of most software written for non-Windows platforms. So whenever I see a program that requires MinGW, I'm always very hesitant to use it. The user experience tends to be terrible. I can still remember an issue trying to compile subversion on Windows using gcc and having it take well over an hour. Turns out with all of the processes being forked and temp files being created, the antivirus program was adding a delay to every command. After completely disabling antivirus it compiled in 15 minutes.
So, in one sense, this ins't a problem with MinGW or msys, but it typical of software that relies on it.
The other issues I have with them is that they don't integrate well with the native tools on Windows. For instance, Pageant is a good, graphical SSH agent on Windows. You have to mess around with environmental variables and plink and junk to get it so you don't have multiple formats of SSH keys on your machine. Trying to deal with SSH through bash and msys is not a user friendly experience. PuTTY is the gold standard of SSH clients on Windows.
Using msys/MinGW is like running X programs on OS X, Windows programs through Wine on Linux, or Java GUIs on any OS. It has enough strange warts and doesn't quite fit the feel of the rest of the OS.
That is where Go was awesome. I downloaded go and there were 3 exes on my machine. I ran "go.exe build source.go" and out popped an exe.
Re: “This change deletes the C implementations of the Go compiler and assembler”
#128Earlier quoted context omitted.
Nicely done. To be fair though, Go is just 6 years old and still evolving.
Exactly. Which is why I think it's important to keep the option of compiling its compiler from a language which has a large diversity of compilers.
Re: “This change deletes the C implementations of the Go compiler and assembler”
#129Earlier quoted context omitted.
Which is of course no answer at all. Their own explanation for wasting hundreds of thousands of man-hours on a "quirky and flawed" separate compiler, linker, assembler, runtime, and tools is because they absolutely needed an implementation detail that is completely invisible to programs and which they are now replacing because it wasn't a good idea in the first place (segmented stacks). And it's worth writing out a 1…
LLVM is a C++ monstrosity that takes hours to compile. Other programming language projects have to maintain a "temporary" fork of LLVM to achieve their goals: https://github.com/rust-lang/llvm/tree/master
Re: “This change deletes the C implementations of the Go compiler and assembler”
#130Earlier quoted context omitted.
My understanding is that they wrote code that translated the C code for the original Go compiler into Go code. This translation wasn't fully general -- it made assumptions about how the C code was written -- but it allowed the port from C to Go to be very precise (i.e. bug for bug). So now that the Go compiler written in Go can compile Go, that's what they'll use going forward, and they will slowly work to make it in…
Its generally called "self-hosting" when a compiler can compile itself[1]. It was a pretty big deal when Clang became self-hosting[2] in 2010. [1] https://en.wikipedia.org/wiki/Self-hosting [2] http://blog.llvm.org/2010/02/clang-successfully-self-hosts.h...