darcs patch: Remove unsafeCoerce-importing kludgery in favor of
Uns...
Donald Bruce Stewart
dons at cse.unsw.edu.au
Thu Jun 14 03:42:21 EDT 2007
ashley:
> John Meacham wrote:
>
> >This is why I think an 'Unsafe.*' would be a bad idea. it would be a
> >dumping ground for lots of routines with nothing in common other than it
> >made someone uncomfortable at some point.
>
> Isn't this a good idea? I want to know about this "uncomfortableness"
> especially if I can use such "uncomfortable" routines to segfault my
> program.
>
> >I mean, think if all the
> >ByteString functions dealing with pointers had to move there because you
> >might pass in a bad pointer.
>
> They should be moved there, shouldn't they? All the unsafe stuff is in a
> single module, Data.ByteString.Base. What's the purpose of this module?
> Wouldn't that purpose be better served if it were put in Unsafe.*?
>
> It's more helpful to me when reading a program to see the red flag
> "import Unsafe.ByteString" rather than the apparently innocuous "import
> Data.ByteString.Base"...
They are tagged as 'unsafeFoo', of course. So using, say, unsafeTail
does hint that you are to check a side condition yourself.
Btw, the *.Base form is inherited from Data.Array.Base.unsafeRead/Write.
The modules serve similar purposes.
-- Don
More information about the Libraries
mailing list