What would you do with Compiler as a Service
Asked Answered
P

5

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?

Piny answered 19/11, 2010 at 6:7 Comment(1)
an interesting link msdn.microsoft.com/en-us/hh500769Lianne
W
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

Wolf answered 8/4, 2011 at 12:55 Comment(2)
All in favor of anything that will get VB AutoComplete into LINQPad!Rosenberger
Just as info: BUILD2011 introduced The Rosyln Project Future directions for C# and Visual BasicRosenberger
T
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.

Tsui answered 19/11, 2010 at 14:53 Comment(1)
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?Piny
O
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.

Obligor answered 5/5, 2011 at 19:33 Comment(0)
S
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.

Salt answered 24/11, 2010 at 10:22 Comment(0)
I
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.

Irrational answered 22/8, 2011 at 17:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.