More Macros in Nemerle
After a very brief introduction to Nemerle metaprogramming , what follows is some motivation and better expression macros examples. Historically in C#, the using statement has been abused (guilty!) to provide a more convenient syntax to operations that have natural wrap up code which should be executed at the end of a logical scope. To enable a class to be usable like this, it just needs to implement the System.IDisposable interface. The problem is that these elements were designed with a very specific and important goal in mind: the deterministic disposal of unmanaged resources. That's why using wraps the call to IDisposable.Dispose() in a finally block: it has to run no matter what. A finally block is a very strong statement. It runs in the presence of exceptions, and it can't be interrupted by a ThreadAbortException , what can delay a whole application domain shutdown. That's justified for releasing resources, but it is too strong a statement for simple wrap...