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 13:34

A minor point, perhaps, but Java’s Optional is not free. Due to Java lacking ‘value types’, essentially just stack allocation, you must allocate on the heap to wrap a type in Optional. And, due to that lack of value types, you can not wrap a primitive type in an Optional - so you’re again forced to make use of the heap when it may not be necessary. These are minor annoyances, but coming from lower level languages I definitely find it irksome to be forced to use the heap in places where the stack is obviously acceptable.

Our Rust OptionString type actually has the same overhead as a check for null. There is 0 memory overhead, 0 allocation performed. Because ‘null’ (0) is not a valid address for our String type, we can use that to represent the Absent variant under the hood.

https://insanitybit.github.io/2016/12/28/why-rust-sum-types

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