Crazy suggestion: ByteString -> Bytes

Vladislav Zavialov vlad.z.4096 at gmail.com
Mon Jan 7 09:35:27 UTC 2019


ByteString may not be the best way to represent a sequence of bytes, as it
contributes to heap fragmentation by using pinned memory.

Its primary use case should be FFI, and it's largely misused today.

If we rename it, let's call it "PinnedBytes", and use the name "Bytes" for
ShortByteString, ByteArray, or Array Word8

All the best,
Vlad


On Mon, Jan 7, 2019, 12:25 Merijn Verstraaten <merijn at inconsistent.nl wrote:

> Ok, so I think there is a fairly wide consensus that the name ByteString
> is a pretty misleading historical naming mistake. On the other hand, I also
> realise bytestring is at the very core of the Haskell ecosystem and any
> breakage has to be avoided at all cost...
>
> So I was just wondering on IRC what (if any?) problems we'd run into if we
> released a "bytes" package that's just s/ByteString/Bytes of bytestring
> (Data.Bytes, Bytes type, etc) then turn bytestring into a hollow shell that
> just re-exports Data.Bytes as Data.ByteString, etc. and defines "type
> ByteString = Bytes".
>
> I realise there's no way we'll get rid of bytestring itself any time soon
> (if ever), but at least we could point new code and beginners at a less
> confusingly named type. Added bonus Bytes is considerably shorter to type!
>
> Cheers,
> Merijn
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190107/58b70ec0/attachment.html>


More information about the Libraries mailing list