Yesterday the scriptcs project got an little injection of awesomeness through a set of new REPL commands we have added. You can now conveniently access a bunch of contextual information about your REPL session – the idea is to make your work with the REPL smoother, more productive and, of course, more enjoyable. Let’s quickly walk through them in this post.
By the way, it’s a good moment to remind that the REPL command infrastructure is fully extensible – so you can easily build up your own commands. Watch my talk from NDC Oslo if you are interested, there is an example in there.
This is not yet released – will be part of the next release, 0.12 – so for now you will have to use nightly builds to try it out (or build from source). Instructions are available here
REPL now has a :help command which lists all the commands available along with a short description.
Typing in :references will show you the list of assemblies currently referenced by your REPL session. As soon as you reference more (i.e. using #r) they will obviously show up too – in the example below we import JSON.NET and you can see it being added to the list. Notice that some of the references have no “dll” extension – those are GAC references.
Typing in :usings will show you the list of namespaces currently imported into your REPL session. Similarily to the references, as soon as you import more, they will show up too. I used Newtonsoft.Json as an example here again.
This might be the coolest of all, it will show you the local variables that currently exist in the REPL session – you just need to type in :vars. Since in REPL you can overwrite variables, the output of the command will adjust accordingly as your REPL session lives on.
:alias allows you to alias one command with a different name. This way you can use your own aliases if the built-in names are too long for you, or you simply don’t like them. Currently aliasing only lives on for the duration of the REPL session, however we do plan for allowing of persistence of the aliases in the future.
Interestingly you not only have to alias using a basic string-to-string mapping, but you can actually use a string variable from your REPL too – like in the example below.
All right, take this for a spin now with the nightlies or the source, and give us some feedback at Github. Otherwise, wait for 0.12 release Hopefully you like it!