Easier log4net configuration is here

I have just released a version of a new project I have been working on after being inspired by Ayende’s ‘Building Domain Specific Languages in Boo‘ e-book, the project is aimed at making log4net configuration easier by using a DSL instead of XML it’s called log4net-altconf and is hosted on google code you can grab the source using a SVN client, I would recommend TortoiseSVN.

It’s early days so some of the syntax will need to be ironed out and there will no doubt be other things that need to be looked at, hopefully someone with better knowledge with this type of thing can give some pointers 🙂

I could probably have had this done a few days back however I was wrestling with NUnit’s addin’s in order to have a set of test DSL’s to test the main DSL that set me back quite a bit!

If you have any comments please feel free to post them here.


Macro Woes with DSL in Boo

Lately I have been working my way through Ayende’s Building Domain Specific Languages in Boo, it’s a really good read and would recommend it to anyone wanting to put together their own DSL and also to learn about the meta programming that Boo has to offer.

Anyway this afternoon I spent a long time trying to get a macro to work for my DSL using Rhino DSL, in the end I think it was a number of issues, so here is a list of things to check if your macro is not working:

  1. Make sure that the namespace of where the macro is declared is passed thorugh to the ImplicitBaseClassCompilerStep, this can be done in the constructor, which takes a string array of namespaces.
  2. When you name the macro it must be in pascal case, I was falling foul because in my DSL I was referring to it as add_foo so named it add_fooMacro, this doesn’t work it must be Add_fooMacro.
  3. If the macro is declared in a seperate assembly to the rest of your DSL classes you will need to add a reference to the assembly for the Boo compiler.
  4. This one is a general rule, don’t try to use macros inside macros (using, lock etc…) they ain’t gonna work!

As for the DSL project I’m working on… watch this space :o)

Power of Boo

After spending some time looking at examples of the meta programming Boo supports by having an open compiler it got me thinking how you could effectively generate boilerplate code for a class by just decorating it with an attribute, the example I was thinking of was of the standard singleton design pattern, the general setup for a singleton object involves:

  • having a private constructor
  • having a single static instance variable holding the type of the singleton
  • exposing an static instance property/method that returns the instance variable
  • possibly thread locking code if it will be used in a multi-threading environment

Now with Boo you can use an inherited attribute class of the AbstractAstAttribute to make adjustments to classes, fields, methods etc…

And just as I was thinking you could have a SingletonAttribute to perform the above standard tasks I came across this https://docs.codehaus.org/display/BOO/Useful+things+about+Boo someone has already implemented it!

I’m starting to really appreciate how powerful this language is 🙂

Here’s looking at boo


Boo is a .NET language I have recently been looking at and having a mess-around with it’s a very cool language that is based on python syntax, I have never looked at python before so I’m not in a position to compare the two.

Why use it?

Your probably thinking yeah another .NET language so what we have C# why bother with this one, I kind of felt this way before I looked into it, but now I see the potential this language has, some reasons why:

  • Duck typing – Boo is statically typed however it is clever enough to infer types so you end up with shorter syntax with less duplication
  • Open Compiler – This is the biggest thing going for Boo, you can change the workings of the compiler to your own needs giving you the power to create DSL’s
  • Built-in literals – declaring a regex like this /\d+/ and an array like this x=(1,2) is very cool
  • Extensibility points – Either by macros or meta methods you can add/edit the syntax for the compiler to use, this leads to reduced boilerplate code
  • Plus much more you can check out at the Boo homepage…

I would really suggest having a look and to try it out, at the moment I’m using it with SharpDevelop as at the moment it doesn’t run as well in vs2008 with BooLangStudio.

Related Links