[Haskell-cafe] Error in array index.

Claus Reinke claus.reinke at talk21.com
Thu Jun 25 03:50:12 EDT 2009


>  It's too bad that indexes are `Int` instead of `Word` under
>  the hood. Why is `Int` used in so many places where it is
>  semantically wrong? Not just here but also in list indexing...
>  Indices/offsets can only be positive and I can't see any good
>  reason to waste half the address space -- yet we encounter
>  this problem over and over again.

Readers who disliked the above also disliked the following:

    "index out of range" error message regression
    http://hackage.haskell.org/trac/ghc/ticket/2669

    Int / Word / IntN / WordN are unequally optimized
    http://hackage.haskell.org/trac/ghc/ticket/3055

    Arrays allow out-of-bounds indexes
    http://hackage.haskell.org/trac/ghc/ticket/2120
    ..

Not to mention that many serious array programmers use their
own array libraries (yes, plural:-(, bypassing the "standard", so 
their valuable experience/expertise doesn't result in improvements 
in the standard array libraries (nor have they agreed on a new API). 

If any of this is affecting your use of GHC or libraries, you might 
want to add yourself to relevant tickets, or add new tickets. Small
bug fixes, alternative designs and grand array library reunification 
initiatives might also be welcome.

Claus

PS. You could, of course, rebase your array indices to make
    use of the negatives, so the address space isn't wasted, just
    made difficult to use.




More information about the Haskell-Cafe mailing list