So, let's look at what code I wrote in 5 minutes in F#. What's interesting, it worked the first time as was compiled:
I think, this is a great opportunity to use wonderful thread-it macro from "Clojure in Action" book:
It's really both elegant and powerful compared to hand-written "if (arg == null) throw new ArgumentNullException(...)" or using the Microsoft contracts library.
Contracts may be bond right to arguments themselves:
Which causes: "Nemerle.Core.AssertionException: assertion ``name != null && name.Length > 0'' failed in file Main.n, line 107: The ``Requires'' contract of parameter `name' ha s been violated." Amazing! :)
However, if checking for null value is what's only needed, there's one more option: the NotNull macro attribute: