[Haskell-cafe] Haskell Propeganda
jonathanccast at fastmail.fm
Wed Aug 27 15:21:39 EDT 2008
On Wed, 2008-08-27 at 12:23 -0700, Dan Weston wrote:
> Tim Docker wrote:
> > David Roundy wrote:
> >> Which illustrates the point that it's not type safety
> >> that protects us from segfaults, so much as bounds checking,
> >> and that's got a non-trivial runtime cost. At least, most
> >> segfaults that *I've* caused (in C or C++) have been from
> >> overwriting the bounds of arrays, and that's precisely the problem
> >> that Haskell does *not* solve using its type system.
> > That differs from my experience. Most segfaults that *I've* caused (in
> > C or C++) have been due to dereferencing null pointers. Type safety
> > does help you here, in that Maybe lets you distinguish the types of
> > things that are optionally present from those that must be.
> > Tim
> Huh? Type safety buys you not having to worry about dereferencing stale
> nonnull pointers (lifetime of reference exceeding lifetime of referent),
> but nothing about dereferencing null pointers, which are the moral
> equivalent of Nothing.
Actually, that's garbage collection.
> Failure to handle a null pointer is just like using fromJust and results
> in the same program termination (undefined).
More information about the Haskell-Cafe