Saturday, March 14, 2009 5:14 PM
Discoveries This Week 03/13/2009
This week we have ActionScript byte code manipulation, COM interop in F#, a quick look at the option type, and finally, a very elegant cross product implementation.
This article focuses on using AbcExplorationLib to parse AVM2 ActionScript byte code. AbcExplorationLib is still rather new and does not yet have complete support for all AVM2 instructions. However, it may eventually be useful for static analysis or, in the best possible case, flash generation from within .NET languages.
In this post Richard initially walks through the steps involved in getting COM Interop in F# via both early and late binding. He then goes on to programmatically load up a new MapPoint instance and instantiate a pushpin on it. Once the painful COM stuff is out of the way it seems F# could make a rather nice scripting language for Microsoft apps such as this.
We’ve been told that C# 4.0 will offer COM interoperability that is significant less painful due to it’s new named arguments, dynamic typing and language binding layers. After reading this article, I can’t help but wonder how much of this (if any) will be available in F#. In the CTP release both early and late binding are rather painful.
It’s a rather simple question, but I do like how the community came out to help answer it. Although, I do think it’s very debatable whether null or -1 make for a better answer to the question “how long is this null string?”.
Generally, I’m opposed to hiding information inside of a type meant to hold something else, especially if it’s a scalar value. Were it not for the overhead involved, in C# I would think the best solution would be to throw an exception. Inside F#, at least with option types you know you are handling an exceptional case and not just an empty variable. Yet another great benefit of immutability.
I wanted to include this as Tomas Petricek’s solution was extremely elegant.