May 2008 Archives

[thumbnail000.jpg]

Very cool talk by Steve Yegge, available in video or transcribed form. I particularly enjoyed tooling part:

Moving right back along to our simple dynamic languages, the lesson is: it's not actually harder to build these tools [for dynamic languages]. It's different. And nobody's done the work yet, although people are starting to. And actually IntelliJ is a company with this IDEA [IDE], and they... my friends show off the JavaScript tool, you know, and it's like, man! They should do one for Python, and they should do one for every single dynamic language out there, because they kick butt at it. I'm sure they did all this stuff and more than I'm talking about here.

I'd add couple more modern IDE tools supporting dynamic languages: NetBeans (Javascript/Ruby) and Visual Studio 2008(Javascript, IronPython via IronPython Studio). But Steve is completely right - this is just the beginning.

Hacking IronRuby

| 7 Comments | 2 TrackBacks |

IronRuby is coming! Expected to be released this year Microsoft's IronRuby is quite a unique project. Fully open sourced, OSI-approved/GPL-inspired  license, hosted at Rubyforge, accepting external contributions. Yes, Microsoft's IronRuby. Cool.

Anyway, I decided why don't I build IronRuby version of the famous "Try Ruby in your browser" by _why? So anybody with 15 free minutes at hands could play with IronRuby. That sounds like cool way to learn IronRuby internals.

IronRuby includes ir.exe - nice interactive IronRuby shell. Thanks to open sources I managed to hack up simple AJAXish Web version in just one night. ASP.NET 3.5 application hosting IronRuby runtime + simple Web console emulating ir.exe.

It's hosted at http://www.ironruby.info/ir, currently at version "0.first.hack". Go play with it, but please don't crash it often. Here is a screenshot for those lazy ones:

Hosting a programming language shell on Web poses additional interesting problems. Ruby is a powerful language and IronRuby additionally provides access to the whole .NET framework. Letting anybody writing and executing any programs on my shared hosting??? Well, I managed to make it running under Minimal Trust level, which means execute permissions only. No file system, no network or Web access, nothing. That should be safe enough, but please don't hack me. Learn IronRuby instead!

Go Try IronRuby in your browser.

Any comments are welcome!

IronXSLT v0.3 released

| 4 Comments | 2 TrackBacks | , ,

Here is a small quick release. IronXSLT v0.3.

New in this version:

A very little known fact is that Visual Studio 2008 does support real XSLT intellisense - not a static XSLT schema-based one, but real dynamic intellisense enabling autocompletion of template names, modes, parameter/variable names, attribute set names, namespace prefixes etc.

For some obscure reason it is off by default and obviously completely undocumented. I'll show you how to turn it on. But before - a little teaser.

1. When you about to call a named template you are presented with a list of all named templates in your stylesheet. My favorite feature. Finally you don't have to remember all your template names:

2. In XSLT template parameters are passed by name, so when you call a template and want to pass parameters you actually have to know exactly what parameter names are. And you better know them for sure, because if you make a mistake you pass a parameter with wrong name you get no error or even warning. XSLT 1.0 specification allows such nonsense.  That's why template parameter name autocompletion is a real time saver:

3.  You can pass parameters when applying templates too. Obviously due to dynamic XSLT processing model it's hard to know in advance which template will be matched at run time, so it's hard to suggest list of parameter names. In this version of XSLT intellisense we get list of all parameters used in all templates, filtered by mode. I believe XML Tools could optimize it a bit by filtering the list when it's clear from the context which template will be matched. Anyway, very useful:

4. Autocompletion of template modes is also extremely useful. Make mistake in mode name and you can spend hours in debugger trying to figure out why your template isn't matched, because again this is not an error or even something wrong according to XSLT spec. That's why this is so cool:

5. Finally a couple of useful namespace prefix autocompletions. exclude-result-prefixes now becomes easier:

and <xsl:namespace-alias> (mostly used for generating XSLT using XSLT):

6. If you use <xsl:attribute-set> elements, you will be happy to see this one:

 

These are autocompletions I'm currently aware of. There might be more - it's currently completely undocumented and I probably the first one writing about this feature. For example key names are collected too, but I haven't found where they are used. If you happen to discover another XSLT autocompletion, report it in comments section please.

And finally how to turn this awesomeness on:

Yes, regedit. Create String value called "XsltIntellisense" under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\XmlEditor" key. "True"/"False" are valid values.

If you are too lazy for editing registry manually, here is XsltIntellisense.reg file you can run (but rename it to .reg before).

If you don't want to mess with registry, wait till tomorrow. I'm going to release IronXSLT v0.3, which will turn XSLT intellisense on for you while installing.

Enjoy!