Dan Byström’s Bwain

Blog without an interesting name

Archive for April, 2005

More on nulls

Posted by Dan Byström on April 19, 2005

I’ve previously written a couple of blog posts on an idea of mine: the possibility to have language support for avoiding null reference exceptions.

I had planned to close the matter down in an article claiming that a “with” keyword could be implemented in C# with the ability to take a different path when the “with”-expession couldn’t be evaluated because a null reference exception would occur trying to do so.

Example:

with ( Order order = a.b.c.d.e )
{
    ...
}
else
{
   // either a or b or c or d or e is null and therefore
   // it would be pointless to enter the "with" block
}

Well, now it turns out that I’m not the only one having felt the need for something like this. It is implemented in the Cω research language:

  Cω takes this one step further with the behavior of returning null instead of throwing a NullReferenceException on accessing a field or property of a nullable type whose value is null.

I knew it was a good idea!!! 🙂

Advertisements

Posted in Programming | Leave a Comment »

Still alive

Posted by Dan Byström on April 19, 2005

…although my absence from here might have lead you to believe otherwise.

The answer is simple: I have way too much work for finding the right "blog mode".

I’m working on an exciting project (in C#) where I’ve come up with a number of interesting things to write about in the future, when I have more time. For example, a vast amount of new GUI UserControls, as well as an interesting solution for synchronizing data between clients by using direct socket communication instead of bogging down the database.

Posted in Uncategorized | Leave a Comment »