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

License for code examples in documentation #11

Open
sidkshatriya opened this issue Apr 4, 2023 · 4 comments
Open

License for code examples in documentation #11

sidkshatriya opened this issue Apr 4, 2023 · 4 comments

Comments

@sidkshatriya
Copy link
Contributor

sidkshatriya commented Apr 4, 2023

There are some useful code examples in the documentation, especially regarding static callbacks, for instance.

See https://github.com/fdopen/ppx_cstubs/blob/638b019ab5eb0d8a187710d00414a1d2536e249c/docs/static_callbacks.md

The general algorithm is straightforward: We store the data associated with each closure in a hash table (with function store_closure). The hash table is keyed with an automatically incrementing integer. This integer is converted to a raw pointer and given to the C-code when we register the callback. This raw pointer (i.e. integer) is given back to us by the C-code when the OCaml callback is invoked and we can look up the same hash table with it to get the data for the closure (with function get_closure).

This is great and there are probably not many alternative approaches to implement this algorithm in OCaml in a simpler/nicer way than you have done.

It would greatly appreciated if you can clarify the license the code samples appearing in the documentation fall under, if people want to reuse this

Ideally, the code samples would be under a liberal license/CC0. Interestingly the Ocaml project has recently done this -- see ocaml/ocaml#12097

If sample code is under LGPL too then again one would need to understand if there are any license virality implications since now you would now be using this directly in your code.

To not worry about licensing one could argue that that you could just re-implement this algorithm yourself but it essentially be the sample implementation because there not that many ways of writing the same algorithm in OCaml !

To sidestep all this, I thought it might be better to raise a GitHub issue and request a clarification. This will be useful for everyone who wants to use static callbacks with ppx_cstubs.

@sidkshatriya
Copy link
Contributor Author

TL;DR

  • Request your clarification on what license you intended the code samples in documentation to be under. My presumption is that the code samples are under LGPL also like the rest of the library but I'm just checking with you.
  • Explicitly state the license in the documentation via a commit if possible. Ideally request you to release the code samples under a liberal license like MIT/CC0 etc. but if you still wish for them to be covered by LGPL, that's OK also !

Thanks so much for this library, it is very useful.

@fdopen
Copy link
Owner

fdopen commented Apr 5, 2023

The code examples in the documentation are public domain (CC0). When I eventually find the time, I'll make that explicitly clear in a commit.

@sidkshatriya
Copy link
Contributor Author

Gentle ping :-)

@sidkshatriya
Copy link
Contributor Author

@fdopen Gentle ping :-) -- please see #11 (comment)

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

No branches or pull requests

2 participants