

Microsoft previews Compiler-as-a-Service software - Garbage
http://www.techworld.com.au/article/401071/microsoft_previews_compiler-as-a-service_software/

======
CurtHagenlocher
Unfortunately, this article conflates two things: the C# REPL, and the C#
compiler-as-a-service. Both are part of Roslyn, which is a reimplementation of
the C# compiler written in C#. (It was previously written in C++.) The REPL
could have been implemented on top of the older C++ compiler.

The C# REPL is something that Mono has had for a few years now. The compiler-
as-a-service has some resemblance to what LLVM + Clang enable for a C
compiler.

------
michaelfeathers
The title scared me. My first thought was that they were going to charge per
compile.

~~~
FrancescoRizzi
you are giving them ideas... and me nightmares!

------
haasted
Does anyone have more information on this bit?

 _"It resembles a model developed by Miguel de Icaza's Mono Project, in which
the information the compiler generates about a program can be reused as a
library."_

Sounds very interesting, but the article unfortunately doesn't go into much
detail about the information that is made available.

~~~
bad_user
Basically you can just compile and execute arbitrary strings of C# code at
runtime. Here's a small tutorial on doing something with Mono's
implementation:
[http://weblogs.asp.net/jgalloway/archive/2011/05/26/dynamic-...](http://weblogs.asp.net/jgalloway/archive/2011/05/26/dynamic-
asp-net-mvc-3-models-using-mono-s-compiler-as-a-service.aspx)

~~~
thwarted
So it's eval, and they skip all the dire warnings from everyone about eval
being bad by calling it Compiler as a Service.

~~~
LeafStorm
The main issues with using eval come when eval has access to the scope of
whatever is calling it, as it can make unpredictable changes. Just compiling
and running code constructed at runtime isn't a bad idea in itself, as long as
you use proper techniques to ensure that users can't do code injection.

~~~
thwarted
That's a good point, and is an language design/implementation specific
condition. PHP doesn't create a new stack frame for eval'ed code, so it runs
right in the context of the calling function. In constrast, LambdaMOO does
create a separate stack frame, which is subjected to the same scope rules as
any other function call. You can control if it does or not in perl (by
stuffing some additional syntax into the eval'ed string).

But the usual issue that is bandied about is how it's inefficient because it
needs to invoke the code parser. Searching hacker news for eval shows the wide
range of positions, a lot (but not a wide majority) just parrot the
inefficiency argument. But there are also a few posts with solid reasons to
use eval too.

------
chappi42
Here is the link to the Hejlsberg presentation at build:

<http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-816T> (the Roslyn part
starts at 00:35:45)

------
codedivine
I found a presentation here (pdf): [http://research.microsoft.com/en-
us/events/fs2011/ng_codenam...](http://research.microsoft.com/en-
us/events/fs2011/ng_codename_roslyn.pdf)

