About Jolt.NET Libraries

Inspired by the Boost C++ libraries, Jolt.NET aims to complement the .NET Base Class Library (BCL) with algorithms, data structures, and general productivity tools. It is the hope of the authors that the features of Jolt.NET will one day be part of, or represented in the BCL and the .NET Framework.

Generic Method Support Enabled

Revision #17390 includes support for parsing generic methods and emitting them via the ProxyTypeBuilder class. In addition to the generic type support described in a previous post, the following operations now demonstrate the complete set of public method proxy-generating operations (excluding explicit interface implementations, which are not really public).


void CreateMethods()
{
Type realSubjectType = typeof(System.Array);
ProxyTypeBuilder builder = new ProxyTypeBuilder("namespace", realSubjectType);

// ConvertAll and Find are implemented in terms of generic method arguments.
builder.AddMethod(realSubjectType.GetMethod("ConvertAll"));
builder.AddMethod(realSubjectType.GetMethod("Find"));

builder.CreateProxy();
}


This revision also includes the results of a tool-set upgrade to Visual Studio 9 (2008) with .NET 3.5 SP1. I took the liberty of simplifying some code by replacing many anonymous delegates with equivalent lambda expressions, and replacing explicit delegate types with specializations of System.Func.

I also noticed that upon removal of the initial explicit interface implementation feature, the ProxyMethodDeclarer and InterfaceMethodDeclarer types were very similar. The only difference between these types was that each type defined their own MethodAttributes value as a member variable. By factoring out this variable and moving its definition to a constructor, I was able to further simplify the code by removing one of the "method declarer" types. The following diagram shows the result of this refactoring and updates the class diagram from a previous post.

CodePlex Page Load Performance

Yesterday I noticed that it was taking too long to load a page on the Jolt.NET CodePlex site. I tracked this down to the BrightAds script that was running on the page and then noticed that it wasn't rendering any ads. Ironically, I didn't notice this sooner because I run an ad blocker on some computers, which effectively eliminates the call to the BrightAds server.

It turns out that BrightAds is no longer supported by Kanoodle (see email below), and thus any ad request will ultimately timeout. I don't know when the service was shutdown, but it at least explains some other performance issues reported at CodePlex.

from Adrienne Carrick <adriennec@pulse360.com>
date Fri, Nov 7, 2008 at 6:13 AM
subject RE: Your BrightAds Application Has Been Reviewed

Hi Steve -

The Bright Ads service is no longer available.
You should have received an e-mail notification regarding this.

I apologize for any inconvenience this has caused.

Thank you,
Adrienne


Adrienne Carrick
Associate, Client Relations

Consequently, I've since removed the BrightAds script from the Jolt.NET CodePlex site and guess what?  Pages now load at their normal speed.

Happy browsing!

Generic Type Support Enabled

This morning I committed revision 16788, which includes support for the acceptance of generic types by the ProxyTypeBuilder class. Consequently, the following tasks are now supported:


void CreateTypes()
{
ProxyAssemblyBuilder builder = new ProxyAssemblyBuilder();

// Creates IList<T> and ListProxy<T>:
builder.AddType(typeof(System.Collections.Generic.List<>));

// Creates IStack and StackProxy, the latter of which encapsulates a Stack<int> instance
builder.AddType(typeof(System.Collections.Generic.Stack<int>));

builder.CreateAssembly();
}

void CreateMethods()
{
Type realSubjectType = typeof(System.Collections.Generic.Dictionary<,>);
ProxyTypeBuilder builder = new ProxyTypeBuilder("namespace", realSubjectType);

// Add and ContainsKey are implemented in terms of generic type arguments.
builder.AddMethod(realSubjectType.GetMethod("Add"));
builder.AddMethod(realSubjectType.GetMethod("ContainsKey"));

builder.AddProperty(realSubjectType.GetProperty("Count"));

builder.CreateProxy();
}


If you use the ProxyAssemblyGen.exe program as your driver, then you should familiarize yourself with the .NET Assembly Qualified Name syntax for types. This syntax is used in the XML file that is passed to the console program, and the type names are ultimately passed to a Type.GetType() method for loading.

The ProxyTypeBuilder still lacks support for handling generic methods, and I've added code to explicitly warn a caller when such a method is encountered. My next task will be to work on issue #29, which addresses generic methods. Furthermore, I need to clean-up some of the code, remove some duplication, and ultimately update to Visual Studio 9/.NET 3.5/C# 3.0.

Things are looking good as we approach the first release!