您会使用编译器即服务做什么

发布于 2024-10-03 03:27:09 字数 428 浏览 6 评论 0原文

看到我们可能会在下一个版本中获得此功能,您认为自己能够做哪些事情或者您希望使用此功能做哪些事情?

就个人而言,在代码生成期间(例如在 MSBuild 任务中),我有时希望能够理解项目中的代码,从而可以选择生成更好的(更多代码)。

例如,如果我有一个分部类,其中有一个分部方法,并且发送了某种类型的参数,那么在代码生成时,我可以使用该信息来生成更好的代码。

换句话说,我在编写代码时发布了我的“意图”,并且我可以使用代码生成器来完成繁重的工作。

partial void InitCommandForStoredProc(ref DbCommand command, string storedProcName);

在部分方法中给出这些信息,我可以生成正确的代码。

那么你们都希望能够使用编译器即服务来做什么呢?

Seeing that we'll probably get this feature in the next release what are some of the things you either think you'll be able to do or things you would like to use this feature to do?

Personally, during code generation (say in a MSBuild task) I sometimes wish I could grok the code in the project and thus have the option to produce better (more code).

For example, if I have a partial class that has a partial method with a parameter of some type being sent in, then at the time of code generation I could use that information to generate better code.

In other words, I publish my "Intent" at the time of writing code and I could have code generators to the heavy lifting.

partial void InitCommandForStoredProc(ref DbCommand command, string storedProcName);

Given this info in a partial method I could generate the correct code.

So what do you all hope to be able to do with Compiler as a service?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

暗地喜欢 2024-10-10 03:27:09

为了给出(一个)实际答案,LINQPad 的 IntelliSense 将从 CaaS 中受益匪浅。它将允许自动完成功能同时适用于 C# 和 VB(假设 CaaS 也适用于 VB)。它还将使编写很酷的新重构工具变得容易。

给我们 CaaS,我会让 LINQPad 成为您可以用它做什么的展示:)

这个功能太好了,不能等到 C# 6 / VB 12

To give (one) practical answer, LINQPad's IntelliSense will benefit immensely from CaaS. It will allow autocompletion to work with both C# and VB (assuming CaaS works for VB, too). It will also make it easy to write cool new refactoring tools.

Give us CaaS, and I'll make LINQPad a showpiece of what you can do with it :)

This feature is far too good to wait until C# 6 / VB 12

旧人 2024-10-10 03:27:09

我们可能会在下一个版本中获得此功能

我们尚未宣布与“编译器即服务”策略相关的任何功能或产品的调度或交付工具。 CaaS 是我们希望如何构建未来编译器架构的一项长期前瞻性策略。这不是一种语言功能,而是一种构建工具的策略。在最近的 PDC 上,Anders 做了一些演示,展示了人们可以使用此类工具做的事情,但他没有具体说明此类工具何时发布。您不应该期待它很快就会出现。我们宣布将在下一个版本中推出的唯一功能是 C# 5 的异步等待功能,而且我们也尚未宣布该功能的时间表。

您认为您能够执行或希望使用此功能执行哪些操作?

虽然我个人对这个问题的答案非常感兴趣,但我注意到它不是 StackOverflow 问题的良好候选者。它是模糊的、推测性的和主观的,而不是关于特定的技术编码问题。

不过,感谢您提供您的场景;它们对我有用。

更新:2011 年 10 月

我们刚刚发布了“编译器即服务”项目(又名“Roslyn”)的预览版

我们还没有宣布推出船舶载具;它将在 Visual Studio 11 之后发布。

Seeing that we'll probably get this feature in the next release

We have not announced scheduling or ship vehicles for any feature or product associated with the "compiler as a service" strategy. CaaS is a long-term forward-looking strategy for how we hope to build compiler architectures in the future. It's not a language feature, it's a strategy for building tools. At the recent PDC Anders did some demos of the sorts of things one might be able to do with such tools, but he specifically did not say when anything like that would ship. You should not expect it any time soon. The only feature we have announced will be in the next release is the asynchronous await feature of C# 5, and we haven't announced a schedule for that either.

what are some of the things you either think you'll be able to do or things you would like to use this feature to do?

Though I am personally very interested in answers to this question, I note that it is not a good candidate for a StackOverflow question. It's vague, speculative and subjective, rather than being about a specific technical coding problem.

Thanks for giving your scenarios though; they are useful to me.

UPDATE: October 2011

We have just shipped a preview release of the "Compiler As A Service" project, aka "Roslyn".

We are still not announcing a ship vehicle; it will be post Visual Studio 11.

趴在窗边数星星i 2024-10-10 03:27:09

我认为这将使面向方面的框架所做的编织过程变得更加强大。现在,他们几乎都使用一些 hacky 技术,这些技术对您的实现提出了要求,例如从 ContextBoundObject 继承,或者使所有方法虚拟。拥有 CaaS 将使 AOP 框架成为 .NET 中的一等公民,我认为这将是一个巨大的好处。

I think it would make the weaving process that Aspect Oriented frameworks do, much more powerful. Right now they almost all use some hacky technique that put's requirements on your implementation like inherit from ContextBoundObject, or make all your methods virtual. Having CaaS would make AOP frameworks first class citizens in .NET and I think that would be a huge benefit.

北座城市 2024-10-10 03:27:09

在 .NET Rocks! 的第 541 集中,Anders 表示 C# 5 的主题将是编译器即服务。

Anders Hejlsberg:我可以告诉你,我们正在做的事情之一是
主题,每个版本都有一个主题。

理查德·坎贝尔:对。

Anders Hejlsberg:在 4.0 中,您可以说主题是 Dynamic,而在 3.0 中则是 LINQ。这
5.0 的主题是服务中的编译器,这就是我们的想法

http:// www.dotnetrocks.com/text/0541/index12.html

自 2010 年 4 月播出此播客以来,2010 年 PDC 上的进一步公告表明主题将不再是编译器即服务,而是异步编程。尚未发布任何公告来说明为什么需要更改主题。

On episode #541 of .NET Rocks!, Anders said the theme of C# 5 will be Compiler as a Service.

Anders Hejlsberg: I could tell you though that one of the things we're working on is this
theme and every release has sort of had a theme.

Richard Campbell: Right.

Anders Hejlsberg: In 4.0, you could say the theme is Dynamic, and in 3.0 it was LINQ. The
theme for 5.0 is compiler at the service, it's how we're thinking about it

http://www.dotnetrocks.com/text/0541/index12.html

Since April 2010, when this podcast was aired, further announcements at the 2010 PDC indicate the theme will no longer be Compiler as a Service, but instead will be Async programming. No announcements have been made to indicate why a change of theme was required.

痕至 2024-10-10 03:27:09

我怀疑元编程将通过 CaaS 实现巨大飞跃。我想 Lisp 宏之类的东西将可以被模拟。我还期待能够操纵内部 DSL 之类的语法,或者模仿其他语言的语法,例如,我喜欢 Python 的列表和元组语法。我对 CaaS 的了解还不够,无法判断这一切是否可行,但我可以想象它。

I suspect that metaprogramming will take a huge leap forward with CaaS. I imagine things like Lisp macros will be possible to emulate. I also look forward to the possibility of manipulating syntax for things like internal DSLs, or mimicking syntax from other languages, e.g. I like Python's syntax for lists and tuples. I don't know enough about CaaS to say if all of this is possible, but I can picture it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文