27

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?

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Shiv Kumar
  • 9,599
  • 2
  • 36
  • 38

5 Answers5

58

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

Joe Albahari
  • 30,118
  • 7
  • 80
  • 91
  • 15
    All in favor of anything that will get VB AutoComplete into LINQPad! – Airn5475 Apr 08 '11 at 14:17
  • 1
    Just as info: BUILD2011 introduced _The Rosyln Project_ [Future directions for C# and Visual Basic](http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-816T) – Airn5475 Sep 21 '11 at 15:31
19

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Eric Lippert
  • 647,829
  • 179
  • 1,238
  • 2,067
  • Eric, yes I realize that there is no fixed date nor commitment for CaaS. But that doesn't nor should it stop us from thinking of it's uses. Maybe you should ask this question on your blog or other place in a more official context? – Shiv Kumar Nov 19 '10 at 17:45
7

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.

Matt Dotson
  • 5,887
  • 1
  • 23
  • 23
3

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.

RichB
  • 520
  • 5
  • 10
3

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.

Roly
  • 1,516
  • 1
  • 15
  • 26