Skip to content
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

Split off Signed/Unsigned modules into a new package #446

Closed
yallop opened this issue Sep 17, 2016 · 17 comments
Closed

Split off Signed/Unsigned modules into a new package #446

yallop opened this issue Sep 17, 2016 · 17 comments

Comments

@yallop
Copy link
Owner

yallop commented Sep 17, 2016

The Signed and Unsigned modules don't depend on the rest of ctypes, and might be useful elsewhere (e.g. for TCP sequence numbers, or for angstrom.) So splitting them into a separate package could be worthwhile.

@dbuenzli
Copy link
Contributor

What do you think about at least trying to ask the ocaml dev team to upstream UintX for each existing IntX in the stdlib ? I constantly need these.

@yallop
Copy link
Owner Author

yallop commented Sep 17, 2016

I agree that it would be good to have them in the standard library. If there was some indication of support from the maintainers I'd be happy to send a pull request.

@dbuenzli
Copy link
Contributor

I don't think it is worth working on it without at least an indication that those modules are desirable on principle and would be merged. You should maybe ask on their internal mailing list.

@hcarty
Copy link

hcarty commented Sep 17, 2016

I created an issue on mantis for unsigned 32 and 64 bit integers: http://caml.inria.fr/mantis/view.php?id=7280

The response was somewhat positive... Having a concrete and complete proposal may help push this along.

@yallop
Copy link
Owner Author

yallop commented Sep 19, 2016

Here's a new package, ocaml-integers, with the Signed and Unsigned modules:

https://github.com/ocamllabs/ocaml-integers

@yallop
Copy link
Owner Author

yallop commented Nov 26, 2016

You should maybe ask on their internal mailing list.

I've sent a mail to the list to see whether there's any support for upstreaming the unsigned integer modules.

@emillon
Copy link
Contributor

emillon commented Apr 27, 2017

Hi, just wanted to know if there are plans to add a dependency from ctypes to ocaml-integers and use those types.

@yallop
Copy link
Owner Author

yallop commented Apr 28, 2017

Yes, using the types in ocaml-integers is planned. Is that something you have a need for soon, @emillon?

@emillon
Copy link
Contributor

emillon commented Apr 28, 2017

No, there's nothing immediate on my side, but that would definitely be an improvement.

As a data point, my use case would be splitting code that uses ctypes types (Unsigned.ULong.t & friends) from code that can emit calls. That way, the first part does not need libffi, and depend on way less C code, which can improve portability and reduce attack surface.

@dbuenzli
Copy link
Contributor

@yallop Did anything come out of that email about upstreaming the unsigned modules ?

@yallop
Copy link
Owner Author

yallop commented Apr 28, 2017

@dbuenzli: I understand that there was some inconclusive discussion at the developers' meeting, but I haven't heard anything directly.

@dbuenzli
Copy link
Contributor

Maybe it would be better to have a living PR then...

@emillon
Copy link
Contributor

emillon commented May 9, 2017

Adding it to OCaml itself would be great, but in the meantime would you be interested in a PR to use ocaml-integers in ctypes?

@yallop
Copy link
Owner Author

yallop commented May 9, 2017

@emillon: yes, I'd welcome such a PR.

@emillon
Copy link
Contributor

emillon commented May 9, 2017

Great! I think @bbc2 has a WIP branch somewhere, let's discuss around some code when we have something working.

bbc2 added a commit to bbc2/ocaml-ctypes that referenced this issue May 9, 2017
The Signed and Unsigned modules have been extracted to the integers
package for use without a dependency on ctypes but ctypes still hadn't
migrated to that new package.

Closes yallop#446.
@yallop
Copy link
Owner Author

yallop commented Jun 14, 2017

I've submitted an ocaml/ocaml PR that adds support for uint32 and uint64: ocaml/ocaml#1201

@yallop
Copy link
Owner Author

yallop commented Jul 14, 2017

Fixed by #515.

@yallop yallop closed this as completed Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants