A couple of days ago I was reading a post about dynamic languages (scripting languages with good PR) on lambda the ultimate. The author wrote “’strong’ typing is not the same as ‘explicit typing’”, which is very true and got me thinking about inferred type system, such as the one F# uses.
<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />
The big advantages is that doesn’t seem to be talked about much is that because in inferred type you don’t explicitly say what type an identifier is you get a lot more choice about what you compile it down to. This is especially important in the world of .NET where many different languages could use a library that you produce. F# uses this to be able to support both a generic and non generic CLR with out having use different syntax. This is something that none of the commercially supported languages can offer, and will definitely be supported in the as yet unreleased version 0.7 via –no-generics compiler switch.
For example the following F# code:
let add x = x :: 
Will compile down to equivalent C#:
public static List<A> add<A>(A x)
return new List<A>(x, null);
However specify the –no-generics switch and the equivalent C# is:
public static List add(object x)
return new List(x, null);
While there’s not going to be a huge number of people who will need this feature, it’s nice to know it’s there.