Tuesday, 9 October 2012

Web-based C# REPL (key milestone in O2's development)

Here is a pretty cool development for O2 Platform and FluentSharp. You can now run the O2's C# REPL environment directly from a browser!

Just go to http://csharp-repl.apphb.com/ and try it :)

This is what it looks like:


This is pure C# so anything that is valid in C# (variables, for-each-loops, if-else, lambdas,etc...)  will work.

Note that when coding the REPL script you are supposed to return a value, and if your code doesn't compile you will get an error like this:


What is really powerful is that you can download external dependencies and consume them directly.

In the code sample below we are fetching the MarkdownSharp.dll assembly, setting a MarkdownSharp namespace and creating an instance of the Markdown class:


IMPORTANT: all scripts are logged and publicly available here: http://csharp-repl.apphb.com/CSharp_REPL.asmx/CurrentLogFile_Contents  (please try not to abuse AppHarbor hosting services)

The source code of this is at GitHub (https://github.com/o2platform/Web_CSharp_REPL) with automatic deployment to AppHarbour on Git Push.  I tried to keep it as simple as possible and (as I mention on the README) I would like to credit the http://www.jshint.com guys who's website I based the theme on.

What do you think? What should be the next steps?