3 ms·
Why not AOT compiled C#, given the team's historical background?
by pjmlp 2y ago
Why not AOT compiled C#, given the team's historical background?
- tgv 2y agoNot involved, but there's a faq in their repo, and this answers your question, perhaps, a bit: https://github.com/microsoft/typescript-go/discussions/411 https://github.com/microsoft/typescript-go/discussions/411
- pjmlp 2y agoThanks, but it really doesn't clarify why a team with roots on the .NET ecosystem decided C#/Native AOT isn't fit for purpose.
- deleted 2y ago[deleted]
- vessenes 2y agoPure speculation, but C# is not nearly the first class citizen that go binaries are when you look at all possible deployment targets. The “new” Microsoft likely has some built-in bias against “embrace and extend” architectural and business decisions for developers. Overall this doesn’t seem like a hard choice to me. Cue rust devotees in 3, 2, ..
- deleted 2y ago[deleted]
- zozbot234 2y ago> Cue rust devotees in 3, 2, .. If you are a rust devotee, you can use https://github.com/FractalFir/rustc_codegen_clr https://github.com/FractalFir/rustc_codegen_clr to compile your rust code to the same .NET runtime as C#. The project is still in the works but support is said to be about 95% complete.
- spankalee 2y agoI don't understand what Anders' past involvement with C# has to do with this. Would the technical evaluation be different if done by Anders vs someone else?
- pjmlp 2y agoYes, when the author of the language feels it is unfit for purpose, it is a different marketing message than a random dude on the Internet on his new startup project.
- mike_hearn 2y agoC# and Go are direct competitors and the advantages of Go that were cited are all features of C# as well, except the lack of top level functions. That's clearly not an actual problem: you can just define a class per file and make every method static, if that's how you like to code. It doesn't require any restructuring of your codebase. There's also no meaningful difference in platform support, .NET AOT supports Win/Mac/Linux on AMD64/ARM i.e. every platform a developer might use. He clearly knows all this so the obvious inference is that the decision isn't really about features. The most likely problem is a lack of confidence in the .NET team, or some political problems/bad blood inside Microsoft. Perhaps he's tried to use it and been frustrated by bugs; the comment about "battle hardened" feel like where the actual rationale is hiding. We're not getting the full story here, that's clear enough. I'm honestly surprised Microsoft's policies allowed this. Normally companies have rules that require dogfooding for exactly this reason. Such a project is not terribly urgent, it has political heft within Microsoft. They could presumably have got the .NET team to fix bugs or make optimizations they need, at least a lot easier than getting the Go team to do it. Yet they chose not to. Who would have any confidence in adoption of .NET for performance sensitive programs now? Even the father of .NET doesn't want to use it. Anyone who wants to challenge a decision to adopt it can just point at Microsoft's own actions as evidence.
- neonsunset 2y agoThanks, this is a good way to frame it, someone else also phrased similar sentiment which I'm in total agreement with: https://x.com/Lon/status/1899527659308429333 https://x.com/Lon/status/1899527659308429333 It is especially jarring given that they are a first-party customer who would have no trouble in getting necessary platforms supported or projects expedited (like NativeAOT-LLVM-WASM) in .NET. And the statements of Anders Hejlsberg himself which contradict the facts about .NET as a platform make this even more unfortunate.
- doctor_phil 2y agoLink to interview with Anders. (linked from the thread as well) https://www.youtube.com/watch?v=10qowKUW82U&t=1154s https://www.youtube.com/watch?v=10qowKUW82U&t=1154s
- dagw 2y agoThere is an interview with Anders Hejlsberg here: https://www.youtube.com/watch?v=ZlGza4oIleY https://www.youtube.com/watch?v=ZlGza4oIleY The question comes up and he quickly glosses over it, but by the sound of it he isn't impressed with the performance or support of AOT compiled C# on all targeted platforms.
- dimitropoulos 2y agohe went into more detail about C# in this one: https://youtu.be/10qowKUW82U?t=1154s https://youtu.be/10qowKUW82U?t=1154s
- jodrellblank 2y agoHe says: - C# Ahead of Time compiler doesn't target all the platforms they want. - C# Ahead of Time compiler hasn't been stressed in production as many years as Go. - The core TypeScript compiler doesn't use any classes; Go is functions and datastructures whereas C# is heavily OOP, so they would have to switch paradigms to use C#. - Go has better control of low level memory layouts. - Go was ultimately the path of least resistance.
- jasonthorsness 2y agoI am holding out hope for NativeAOT-LLVM https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-LLVM https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-...
- bokwoon 2y agohttps://www.youtube.com/watch?v=10qowKUW82U https://www.youtube.com/watch?v=10qowKUW82U [19:14] why not C#? Dimitri: Was C# considered? Anders: It was, but I will say that I think Go definitely is -- it's, I'd say, the lowest-level language we can get to and still have automatic garbage collection. It's the most native-first language we can get to and still have automatic GC. In C#, it's sort of bytecode first, if you will; there is some ahead-of-time compilation available, but it's not on all platforms and it doesn't have a decade or more of hardening. It was not geared that way to begin with. Additionally, I think Go has a little more expressiveness when it comes to data structure layout, inline structs, and so forth. For us, one additional thing is that our JavaScript codebase is written in a highly functional style -- we use very few classes; in fact, the core compiler doesn't use classes at all -- and that is actually a characteristic of Go as well. Go is based on functions and data structures, whereas C# is heavily OOP-oriented, and we would have had to switch to an OOP paradigm to move to C#. That transition would have involved more friction than switching to Go. Ultimately, that was the path of least resistance for us. Dimitri: Great -- I mean, I have questions about that. I've struggled in the past a lot with Go in functional programming, but I'm glad to hear you say that those aren't struggles for you. That was one of my questions. Anders: When I say functional programming here, I mean sort of functional in the plain sense that we're dealing with functions and data structures as opposed to objects. I'm not talking about pattern matching, higher-kinded types, and monads. [12:34] why not Rust? Anders: When you have a product that has been in use for more than a decade, with millions of programmers and, God knows how many millions of lines of code out there, you are going to be faced with the longest tail of incompatibilities you could imagine. So, from the get-go, we knew that the only way this was going to be meaningful was if we ported the existing code base. The existing code base makes certain assumptions -- specifically, it assumes that there is automatic garbage collection -- and that pretty much limited our choices. That heavily ruled out Rust. I mean, in Rust you have memory management, but it's not automatic; you can get reference counting or whatever you could, but then, in addition to that, there's the borrow checker and the rather stringent constraints it puts on you around ownership of data structures. In particular, it effectively outlaws cyclic data structures, and all of our data structures are heavily cyclic. (https://www.reddit.com/r/golang/comments/1j8shzb/microsoft_rewriting_typescript_in_go/mh8khdw/ https://www.reddit.com/r/golang/comments/1j8shzb/microsoft_r...)
- Cthulhu_ 2y agoI'm not involved in the decisions, but don't C# applications have a higher startup time and memory usage? These are important considerations for a compiler like this that needs to start up and run fast in e.g. new CI/CD boxes. For a daemon like an LSP I reckon C# would've worked.
- neonsunset 2y agoNot when compiled by NativeAOT. It also produces smaller binaries than Go and has better per-dependency scalability (due to metadata compression, pointer-rich section dehydration and stronger reachability analysis). This also means you can use F# too for this instead, which is excellent for langdev (provided you don't use printf "%A" which is incompatible which is a small sacrifice).
- kokada 2y agoWhat is the cross compilation support for NativeAOT though? This is one of the things that Go shines (as long as you don't use CGO, that seems perfectly plausible in this project), and while I don't think it would be a deal breaker it probably makes things a lot easier.
- neonsunset 2y agoWhat is the state of WASM support in Go though? :) I doubt the ability to cross-compile TSC would have been a major factor. These artifacts are always produced on dedicated platforms via separate build stages before publishing and sign-off. Indeed, Go is better at native cross-compilation where-as .NET NativeAOT can do only do cross-arch and limited cross-OS by tapping into Zig toolchain.
- kokada 2y ago> What is the state of WASM support in Go though? :) I am sure it is good enough that the team decided to choose Go either way OR it is not important for this project. > I doubt the ability to cross-compile TSC would have been a major factor. I never said it was a major factor (I even said "I don't think it would be a deal breaker"), but it is a factor nonetheless. It definitely helps a lot during cross-platform debugging since you don't need to setup a whole toolchain just to test a bug in another platform, instead you can simple build a binary on your development machine and send it to the other machine. But the only reason I asked this is because I was curious really, no need to be so defensive.
- rob74 2y agoSeeing that Hejlsberg started out with Turbo Pascal and Delphi, and that Go also has a lot of Pascal-family heritage, he might hold some sympathy for Go as well...
- pjmlp 2y agoYes there is that irony, however when these kind of decisions are made, by folks with historical roots on how .NET and C# came to be, then .NET team cannot wonder why .NET keeps lagging adoption versus other ecosystems, on companies that aren't traditional Microsoft shops.
- ayewo 2y agoAnders explained his reasoning in this interview (transcript): https://github.com/microsoft/typescript-go/discussions/411#discussioncomment-12464695 https://github.com/microsoft/typescript-go/discussions/411#d...
- uticus 2y agothis is the "official" response at this point, since it is in the FAQ linked in the OP