Skip to content

Conversation

@treeowl
Copy link
Collaborator

@treeowl treeowl commented Jun 2, 2023

Use WordPtr instead of Word for Nattish. Word is actually fine, but I think WordPtr makes it more obviously fine, and also adds a bit of insurance against hypothetical future changes to GHC.

Closes #124.

Use `WordPtr` instead of `Word` for `Nattish`. `Word` is actually fine,
but I think `WordPtr` makes it more *obviously* fine, and also adds a
bit of insurance against hypothetical future changes to GHC.

Closes lspitzner#124.
Comment on lines +105 to +109
-- Now, according to a comment on
-- https://hackage.haskell.org/package/base-4.18.0.0/docs/src/Foreign.Ptr.html#WordPtr
-- GHC actually guarantees that a Word is the same size as a pointer, so we
-- actually *could* just use Word, but I think WordPtr makes it *utterly clear*
-- that we're safe here.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? We use WordPtr because it could be bigger than Word, but actually they're always the same size? What's the point then? I think using WordPtr only makes it more confusing, since usually noone uses a pointer as a number type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On GHC they're the same. If someone ports to another implementation, that might not be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're dead set against this, I can go back to Word and explain why it's okay on GHC. That just commits us even more heavily to GHC specifically, rather than to just a compiler with similar power.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type safety issue?

2 participants