News for hackers. Stuff that matters.
Re:Ask HN: What do you think of F#? by nivertech on Sunday October 24, 2010 @04:41PM (#1827207)
Check this Ocaml talk by Yaron Minsky from Jane Street Capital: http://news.ycombinator.com/item?id=1533275

He said, that unlike Ocaml, in F# you still can get Null-pointer exceptions, since it's based on .NET

Re:Ask HN: What do you think of F#? by ppog on Sunday October 24, 2010 @06:47PM (#1827577)
That's partly correct. The danger comes not because F# is "based on" .NET but because it can call into other .NET libraries. F# code by itself, including the F# libraries, won't create null references except in two very specific cases (see http://msdn.microsoft.com/en-us/library/dd233197.aspx). And F# types are non-nullable unless you ask for them to be nullable.

But if you call into non-F# libraries, including .NET framework libraries, then they can return null references. And if your F# code tries to use a null reference obtained in this way OO-style (e.g. making an instance method call through the reference), then that will indeed cause a NullReferenceException.

Obviously, it's easy to wrap 'dangerous' calls to return option values (F#'s equivalent of Haskell Maybe) instead of nulls -- it's a judgment call as to whether it's worth it for any given API.

Re:Ask HN: What do you think of F#? by gtani on Sunday October 24, 2010 @06:42PM (#1827568)
(Disclaimer: f# neophyte, reading Chris Smith's excellent Oreilly book). I think the Option type is used similarly in F# to the Option/Maybe's in scala and haskell:

http://msdn.microsoft.com/en-us/library/dd233245.aspx