3 ms·
> no null reference => no null reference exception This is only true in the same sense that there are no NRE in C# as long as you don't use reference types. F#
by marxama 12y ago
> no null reference => no null reference exception
This is only true in the same sense that there are no NRE in C# as long as you don't use reference types. F# seems to be a fine language, and its non-nullable types are certainly a good thing, but you have to handle null references in F# just like in C#.
- Rickasaurus 12y agoThis is kind of misleading. F# classes/records/unions cannot be given null values by default. Null only ever rears its ugly head when you're working with C#/VB.NET/C++CLI APIs. In practice you catch these out at the boundaries and have nice clean null-free F# code.
- marxama 12y agoEvery so often, I use strings in my code. F# gives me no compile time checks against null references when I'm dealing with strings, nor any other reference type. I did mention that the constructs F# provide are not nullable, which is nice, but that doesn't mean that F# is NRE free. As I said, F# is a nice language, but the "no null reference exceptions" claim, if anything, is misleading. (I'm not very experienced with F# and would be thrilled to be shown that I'm incorrect!)