Proposal: give Ptr a nominal role

David Feuer david.feuer at gmail.com
Thu Nov 1 18:16:36 UTC 2018


Indeed. I think the point is that Ptr should be thought of as tied to
Storable. If you want to use an Addr# for something else, then you
shouldn't be using Ptr!

On Thu, Nov 1, 2018, 2:13 PM Evan Laforge <qdunkan at gmail.com wrote:

> On Thu, Nov 1, 2018 at 10:47 AM Carter Schonwald
> <carter.schonwald at gmail.com> wrote:
> > a good example might be Ptr Char.  Is this a single location of a 32bit
> / utf32 code point, or an array of utf8 code points or utf32 code points?
> > is it null terminated vs there being an extra sequence length? These are
> all valid things that can be happening. And
>
> I'm not sure if it affects your point, but I sure hope a 'Ptr Char'
> points to a 4 byte haskell Char as it claims, and 'Ptr CChar' points
> to a 1 byte C char, as it claims.  Otherwise, sizeOf will be wrong and
> array indexing will go out of bounds.
>
> Of course, in the C case, whether or not there are further chars after
> that and if they are terminated and what is the encoding is all
> ambiguous, as it always is for C.
> _______________________________________________
> 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/20181101/77a9ebbc/attachment.html>


More information about the Libraries mailing list