-
Notifications
You must be signed in to change notification settings - Fork 471
Stdlib: add DataView with littleEndian get/set #7881
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
base: master
Are you sure you want to change the base?
Conversation
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
@htoooth Thank you for your contribution! 👍 Instead of two bindings per function like @send external getInt16: (t, int) => int = "getInt16"
@send external getInt16LittleEndian: (t, int, @as(1) _) => int = "getInt16" could you do single bindings like @send external getInt16: (t, int, ~littleEndian: bool=?) => int = "getInt16" please? (Bonus points for adding doc strings with tests/code examples 🙂.) |
By the way, I also initially thought of adding a parameter like your said @cknitt Where to add tests and documentation? I couldn't find the previous documents and test cases |
Using |
In previous ReScript versions, the approach with the optional argument was not really ergonomic because a trailing unit argument was required. Now that it has become feasible, we have moved to single bindings in the stdlib where possible, as this is much clearer to JS devs, basically resulting in a 1:1 correspondence with the JS APIs as documented on MDN. E.g. Therefore, also the Docstrings are in a corresponding .resi file and contain examples that are automatically verified as test assertions during the CI build. Example:
|
@cknitt I have made the revisions and added the doc. |
No description provided.