More on Heartbleed and related matters
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 29 09:47:53 PDT 2014
On Tuesday, 29 April 2014 at 11:52:04 UTC, bearophile wrote:
> Instead of the ugly and bug-prone mess of "read(fd, &size,
> sizeof(int));" I have used something nicer. "tryRead!uint"
> tries to read an uint, and returns a Nullable!uint. The "Maybe"
> is a function currently missing in Phobos
> (https://issues.dlang.org/show_bug.cgi?id=12679 ), it's used to
> chain other functions on nullables, so bswap gets called only
> if tryRead doesn't return a null value. If tryRead returns a
> null, then Maybe returns a nulled Nullable (currently I think
> "tryRead" is not present in Phobos, but it's not hard to add
> something similar, using parse).
Hopefully we will eventually get a good Option range type in
Phobos, and use it everywhere that is applicable. Even though I
don't like Nullable that much, I wish it or an Option type were
used wherever they could be throughout Phobos. This would make a
lot of code a lot more safe... We're already partway there with
ranges, which are almost monads.
More information about the Digitalmars-d
mailing list