Archive for November, 2007

Overriding extension methods in C# 3.0

November 14, 2007

A language that properly supports modularity must deal with name collisions. In C# 3.0, extension methods allow us to dynamically add new methods to another class. So what happens when methods collide? If I add the same method signature (name + parameters) to a class, what will the compiler do?

  • If I include two different namespaces, and both add the same method, the compiler warns that my method call is ambiguous. That’s good. But how can I explicitly specify which method I want?
  • If the method exists in another namespace and I add the same method, the compiler does not report that I’ve modified an existing method. This means my program could change if anyone working in the same namespace accidently modifies another method. The compiler should warn that I’ve changed an existing method.

Give one, get one: OLPC available now

November 12, 2007

For $400 you can get an OLPC laptop and pay for another for a child in a developing country. Plus, T-Mobile will throw in a year of free Hotspot access, which I believe is worth $30/month ($360/year). I think that may be enough to sway me to buy one. The hardware is impressive. Apparently, the screen can do 1200×900 in grayscale. If it can run Emacs, that’s enough to hack Squeak and Scheme on a lightweight Linux laptop. This may sate my urge to get an Eee.