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: ImperativeGorillaPower 2017-02-02 11:35

Author example
Window* window = get_focused_window();
window->close_window();

Oops! What if there is no focused window? Boom. The fix:

Window* window = get_focused_window();
if (window) {
window->close_window();
}

proper solution:don't use OOP garbage
close_window(Window* window){if(NULL==window)return;/*handle window*/ }
or alternatively a macro version
#define close_window(window) ({int return_value;if(NULL!=window){do_something;};return_value;})


#TaggedPointersOutForHarambe

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