News for hackers. Stuff that matters.
Re:Option and null in dynamic languages by dschiptsov on Tuesday December 09, 2014 @03:25AM (#8721666)
Just None, like Just Nothing is nonsense.

If you have a special marker for something, just explicitly check for it each time.

Re:Option and null in dynamic languages by dschiptsov on Tuesday December 09, 2014 @05:58AM (#8722108)
OK, lets make it long and explicit.

Asserting that an obscure, optional either-of type is some fundamental concept every single language has been overlooked is, of course, nonsense.

The fundamental concept is notion of "nothingness", "emptiness", what other languages call NIL. Without this a language would be very clumsy, like Math without zero.

The notion of empty vs. non-empty is captured in so-called "either-of" types. The most obvious example is '() - an empty list. Conceptually, it is a List, but it is also indicator of "emptiness", of "nothing inside".

A List is an "either-of type" itself, so it does not require any additional specialize type to capture the notion that it could be empty - it already has it.

Another example is so-called "C-strings". There is notion of end-of-string marker, so a string could be viewed as a list instead of an array of characters. In this case (of a list) we don't have define anything special for "empty string" - the notion of "just end-of-string marker" is good-enough.

Again. This Just/Nothing type in Haskell is nothing special or fundamental. It is an optional, non-essential construct.

Re:Option and null in dynamic languages by tome on Tuesday December 09, 2014 @08:20AM (#8722513)
The article explains exactly why it is useful to be able to distinguish `Nothing` from `Just Nothing`.
Re:Option and null in dynamic languages by dschiptsov on Tuesday December 09, 2014 @10:12AM (#8723143)
Yeah, instead of having only "nothing" - NIL - they prefer to have "nothing-in-a-box", and "nothing-in-a-bag", and "nothing-in-a-suitcase". Nothing-in-a-container-of-this-kind.

Due to such over-abstraction madness for sake of abstraction they end up with Java or Javaesque Haskell code.