Maybe type in Fortress

Tim Matthews tim.matthews7 at gmail.com
Mon Jan 18 22:09:54 PST 2010


On Mon, 18 Jan 2010 12:04:15 -0500
bearophile <bearophileHUGS at lycos.com> wrote:

> Just found this blog page. Fortress is a language quite different
> from D because it tries to be innovative (while D tries to be mostly
> a collection of well known good solutions) but it author Guy Steele
> is a good language designer, so some of the ideas of Fortress are
> nice. This post is about the Maybe type in Fortress and its
> consequences (you can guess it...? in Fortress things are notnull by
> default):
> http://projectfortress.sun.com/Projects/Community/blog/MaybeType
> 
> Bye,
> bearophile


Haskell has the 'maybe' monad so not really innovative. Quite simply
to those who don't know what this means: in haskell you don't have
null. You have a 'maybe' monad that has 2 constructors 'just A' or
'nothing'. You then chain monad computations and the 'maybe' monad will
stop on the first 'maybe' that is 'nothing'. 'nothing' is not a type
but a constructor and haskell can match up types based on how they were
constructed.

The article points out "going beyond haskell" with maybe as a
generator. I don't get this bit because in haskell all lists are monads
and a single element list is just like the 'maybe' so this can be done
already and empty lists can be pattern matched on if the extra
assurance is desired.

As the article points cyclone is good example of safer c. Maybe this
could influence D or at least safed if it hasn't already.





More information about the Digitalmars-d mailing list