New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api change: Replace Ptr[Byte]
with Ptr[_] where applicable.
#3753
Api change: Replace Ptr[Byte]
with Ptr[_] where applicable.
#3753
Conversation
… consumers of opaque inputs (void* in C) are good candidates for using Ptr[_]. Allocators `malloc`, `calloc` are still returniong `Ptr[Byte]` becouse it's literally what they do - these function return pointer to first byte of allocated area.
Is this a wildcard type essentially because in C |
Exactly. For Scala 2 and Scala 3 (under old syntax)
While the other two |
No, this makes perfect sense. I just wondered if you could use |
LGTM. This is a good step. I checked, at a high level, that mentions in the documentation happened. Looked like a couple of good type change/corrections in the network code. To make it easier for end users, one could consider adding as a teaching comment, just above the "// type CVoidPointer = // The idiom for C void * is Ptr[_]"
That is where I have and would go looking for a suitable If that appeals I can make a short PR after this merges. If you and/or other |
…low for easier migration if Ptr[_] would not be allowed anymore under Scala 3 at some point
I've added the |
re: I like what you did with the place. Nice change, especially in posixlib. |
Typically consumers of opaque inputs (void* in C) are good candidates for using Ptr[_]. This allows for better DX allowing to skip redundant .asInstanceOf[Ptr[Byte]] conversion.
Allocators
malloc
,calloc
are still returniongPtr[Byte]
becouse it's literally what they do - these function return pointer to first byte of allocated area.