My precious
Ever wonder why I love Ruby so much? Even if not, and probably this is the case, go read the really Poignant Guide to Ruby. Go now. I’ve read the beginning a year ago, and some blog remind it to me today. Lasts chapters with the rabbit are a must read, go read it!
In the mood for work
Cecil’s timeline
- Lazy and Aggressive loading of assemblies
- Both Reflection and Metadata level available
- .net 1.1 profile support
- Assembly round-triping
- modreq/modopt, pinned types, resource embedding, ...
- bugs
- .net 2.0 profile support
- Emit mdb debugging symbols (maybe pdb too)
- bugs correction I guess
- another few bugs
I’ve found something interesting. In SRE, you are able to emit assemblies in memory, then use them directly. I was afraid that with Cecil I had to write the assemblies on the disk before loading them, but it seems that I won’t have to, since there is a Assembly::Load(byte[]) method that should be usable. But i don’t think that it will be a very used feature, because in SRE2, you have almost everything you want to emit at runtime what you need.
Paris
The good thing when someone come to visit you, it’s that you go to places your not used to, even in the city you’re living in. So i’ve spend the last few days visiting Paris, and I have to admit that I love this city (expected the subway). Some pics taken in the “Museum d’histoire naturelle”.
The Module, a new Design Pattern ? 5
I’m partially enthusiast about the partial classes. Here is a sample of code that a French Microsoftee presented to us :
<!
<span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> Person
{
<span class="kwrd">public</span> <span class="kwrd">string</span> firstname;
<span class="kwrd">public</span> <span class="kwrd">string</span> lastname;
<span class="kwrd">public</span> Person (<span class="kwrd">string</span> firstname, <span class="kwrd">string</span> lastname)
{
<span class="kwrd">this</span>.firstname = firstname;
<span class="kwrd">this</span>.lastname = lastname;
}
<span class="kwrd">public</span> <span class="kwrd">void</span> Format ()
{
<span class="rem">// ...</span>
}
}
<span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> Person
{
<span class="kwrd">public</span> <span class="kwrd">static</span> Person FromDataRow (DataRow r)
{
<span class="rem">// ...</span>
}
<span class="kwrd">public</span> <span class="kwrd">static</span> Person FromAnotherDataSource (DS s)
{
<span class="rem">// ..</span>
}
}
Isn’t it a neat design ? Grrrr, I know this is only a sample, to explain the partial keyword, but i know that lots of people will use it this way. Please, use only the partial keyword where it is meant to be.
There and back again 1
I’m back !
I’ve spent a lot of time in the east of France, in Strasbourg. It’s a nice city, with lots of students. Sadly, I left my camera in Paris. Teaching XML, and making XML Schema writing (by hand) attractive for students is definitively not an easy thing. I’ve also visited friends from Evaluant in Mulhouse.
I’ve started working on Cecil again, I’m implementing the writing part of the API. You’ll be able to use both Mono.Cecil and System.Reflection object model, for instance, you can add custom attributes using those two factory methods defined in the ICustomAttributeProvider interface :
ICustomAttribute DefineCustomAttribute (IMethodReference ctor); ICustomAttribute DefineCustomAttribute (ConstructorInfo ctor);
And Cecil will automatically add needed references to assemblies and types. Fun to do, hope it will be fun to use. Sebastien is using Cecil to make some drawing, read part 1 and part 2 of his work.
I’ve bought the Dragon Book !
Nice to read, but it was expansive… I’ve just found on amazon that they are writing a third version of the book, another best seller to come, take a look there. I’ve bought AspectJ Cookbook too, I had to, there is a monkey on the cover ! A good book, I now have few ideas for an AspectDNG in action…
