A More Usable Thread Safe Collection

In my last post we discussed the problems with designing a safer API for mutable thread safe collections that employ only an internal locking system. The result was an API that was more difficult to mess up, yet pretty much unusable. Lets take a look at this problem and see if we can come up with a usable API that still helps to eliminate mistakes.

Why Are Thread Safe Collections So Hard

Writing a collection which is mutable, thread safe and usable is an extremely difficult process. At least that’s what you’ve likely been told all through your schooling. But then you get out on the web and see a multitude of thread safe lists, maps and queues. If it’s so hard, why are there so many examples?

Simulating Closures In Powershell

Previously I blogged about PowerShell’s lack of closure support within a script block. This presents a significant hurdle in developing a LINQ like DSL for powershell which I’ve been working on. Imagine the following syntax

$a = from it in $source where {$it -gt 5 }

Bclextras Library

I published a .Net utility library on Code Gallery today called BclExtras. It’s a set of classes meant to be used in addition to the standard .Net base class libraries (BCL). The main focuses of the library are functional programming, multi-threading, LINQ extensions, unit testing and API’s designed to support type inference.

Powershell Linq Take Count And Take While

The Take pair of functions are very similar to the Skip functions. The Take expression does essentially the opposite of the Skip functions. Skip is useful for getting elements further down the pipeline. Take is used for getting elements from the start of the pipeline.