Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Null pointers are the billion dollar mistake

Name: Anonymous 2017-02-02 10:34

@davetchepak "What can C# do that F# cannot?"
NullReferenceException :-)

Educating the imperative gorillas about sum types:

https://chadaustin.me/2015/07/sum-types/

Name: Anonymous 2017-02-02 14:29

>>7
check everything for null a hundred times
Its checked when its needed, and often function have special "default behavior" with null. If you afraid of NULL so much you can force get_focused_window to return Default_Window dummy object instead of NULL.

sum types don't have anything to do with OOP polymorphism
This is OOP polymorphism with syntax sugar, the case is the static method dispatch on overload of window - which is exactly the same as close_window(Window) C code.
window <- get_focused_window
case window of p
Nothing -> return ()
Just w -> close_window w

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List