一篇采访窥C#的未来

今天坐公交时用手机打开 .NET Blog 阅读这周的 The week in .NET ,在看 Virtual Panel: What's Next for .NET? 这篇采访报道时,被其中对 Richard Lander (Principal Program Manager Lead on the .NET Team at Microsoft) 的一段采访所吸引:

InfoQ: How has the emergence of Roslyn helped the growth of the .NET platform and your language? (C# / F# / VB .NET as appropriate)

Richard Lander: This is a really easy one, and I'm going to bend the question a bit to enable me to include the runtime in the equation. If you think of the .NET runtime, it enables these languages and Roslyn to exist, given the model (mostly garbage collection and type-safe memory) that they expose to developers. So, the absence of that would be C++ (ignoring other industry peers for the moment). The developers on the runtime team work in C++  so that Roslyn can exist and you can use C#. That is very charitable of them!

csc.exe (the pre-Roslyn C# compiler) was also written in C++, so the same model applies there.

It turns out that the developers who write the native components of the platform like C# better. News flash, eh? They actively find ways to do more of their job in and convert more of their codebase to C#. It's a massive over-simplification, but you can think of Roslyn solely as a project to rewrite csc.exe in C#. At the same time, there has been an equally significant trend to rewrite runtime components in C#, too. Particularly for the runtime, it's a significant architectural effort to convert runtime components to C# since you have a bootstrapping problem, but it's worth it.

A C# code-base is hugely beneficial over C++ for a few reasons:

  • It vastly increases the size of the developer base that can contribute to the codebase.
  • We have excellent tools for C# that make development much more efficient.
  • It's straightforward to make a .NET binary work on other chips and operating systems. This is great for bringing up a codebase like .NET Core on something like Raspberry Pi.
  • It's easier to reason about security issues.

So, in my view, the primary trend is moving our existing C++ codebase to C#. It makes us so much more efficient and enables a broader set of  .NET developers to reason about the base platform more easily and also contribute.

用 C++ 开发 的 .NET runtime(估计这里就是指 .NET Core runtime )的组件正在被用 C# 重写,C# 不仅是开发 .NET 应用的首选语言,而且可能取代 C++ 成为开发 .NET runtime 的首选语言,从而成为 .NET 平台的通用语言。如果 C# 既能开发应用,又能开发底层,随着 .NET 跨平台的进展,C# 有望成为 C, C++, Java 之后最流行的编程语言。

上一篇:java模拟斗地主发牌看牌


下一篇:Linux入门基础 #10:命令行文本处理工具