Array interface refactoring

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Feb 22 13:21:55 EST 2006


On Wed, Feb 22, 2006 at 09:59:07AM -0800, Alson Kemp wrote:
> >With unsafeWrite you can write to any address in
> >memory, so 
> >you can crash the program 
>   hmm...  If I put an incorrect index into
> IArray.write, Ix.index errors and the program
> exits/dies/crashes (without SEGV).  This doesn't seem
> much "safer".

There is a huge difference - you know it will fail and how it will fail.
Also, in GHC it will throw an exception which can be caught.

On the other hand, with incorrectly used unsafeWrite your program *may*
fail, but it can also do something bizarre, like sending an email to
Santa Claus or simply returning wrong results.

Best regards
Tomasz

-- 
I am searching for programmers who are good at least in
(Haskell || ML) && (Linux || FreeBSD || math)
for work in Warsaw, Poland


More information about the Haskell-prime mailing list