Use WordPtr instead of Word for Nattish#126
Open
treeowl wants to merge 1 commit intolspitzner:masterfrom
Open
Conversation
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.
konsumlamm
reviewed
Jun 2, 2023
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. |
Collaborator
There was a problem hiding this comment.
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.
Collaborator
Author
There was a problem hiding this comment.
On GHC they're the same. If someone ports to another implementation, that might not be.
Collaborator
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
WordPtrinstead ofWordforNattish.Wordis actually fine, but I thinkWordPtrmakes it more obviously fine, and also adds a bit of insurance against hypothetical future changes to GHC.Closes #124.