#1131: newArray_ allocates an array full of garbage
-------------------------------+--------------------------------------------
    Reporter:  igloo           |        Owner:         
        Type:  bug             |       Status:  new    
    Priority:  high            |    Milestone:  6.8    
   Component:  libraries/base  |      Version:  6.6    
    Severity:  normal          |   Resolution:         
    Keywords:                  |   Difficulty:  Unknown
          Os:  Unknown         |     Testcase:         
Architecture:  Unknown         |  
-------------------------------+--------------------------------------------
Comment (by guest):

 While I don't think it is good practice to rely on newArray_ returning
 random values, the documentation clearly states:

   newArray :: Ix i => (i, i) -> e -> m (a i e)
   Builds a new array, with every element initialised to the supplied
 value.

   newArray_ :: Ix i => (i, i) -> m (a i e)
   Builds a new array, with every element initialised to undefined.

 Possibly, newArray_ shouldn't be defined at all for unboxed arrays, but
 since it is, I think the current implementation is the only reasonable.
 (Presumably, newArray_'s raison d'ĂȘtre is that it is faster than
 newArray?)

 I don't think this is a bug at all, and I don't understand at all why it
 is given a 'high' priority.  Stefan should use newArray, and iampure
 should expect his programs to break without warning in the future :-)

 -k

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1131>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to