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-03 7:58

>>31
This is interesting, I'll look into it.

>>32
The differences have been expounded in lots of places, including this thread. Basically, a sum type is a tagged union where

a) you cannot get the payload without checking tag; the type of payload is guaranteed to be what was declared for that particular tag;

b) the compiler can check that everywhere you inspect the payload of such a tagged union, you include code branches for every possible value of the tag; this is called exhaustiveness checks;

c) with sum types, you get pattern matching which is like Common Lisp's DESTRUCTURING-BIND on steroids: handles nested types, creates bindings concisely, handles conditions on payload (for example, Some(5) may be a separate branch than Some(x), with the second one handling all values of payload x except 5), makes deconstruction of values correspond syntactically and structurally to their construction.

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