-
Notifications
You must be signed in to change notification settings - Fork 44
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
example of switching p2a to dune #6
base: master
Are you sure you want to change the base?
Conversation
This seems like a really good idea. Easy integration with |
Off the top of my head, no. But I'm sure there is a way, and I'd be happy to look into it. |
Only if it's not too much trouble. I'd greatly appreciate it. |
This is in the p4 directory? Just sets.cmi / sets.cmo -- is that right? |
See: https://discuss.ocaml.org/t/dune-link-against-cmo-cmi-without-source/2488 Short answer: there isn't a way to do this. |
Yes, for P4 it's not as necessary (it provides a canonical implementation of a prior project they implemented in P2 just so they don't have to learn a new library). It's really more necessary for P3B where we give a correct lexer and parser. During the summer we did away with all this and just suggested they copy in prior code, mainly to avoid bytecode version incompatibilities since many people had different OCaml versions. However for some students, bugs in their prior projects only manifested in later projects. This was a very difficult problem to debug (both for them and in office hours). I don't really think there's a nice complete solution to all this. Nonetheless, I will definitely talk to Dr. Mamat about switching to |
I assume that the reason for not giving them the source for the canonical implementation is that you don't want it to be distributed (i.e. cheating, etc.)? Dune has support for generating lexers / parsers from .mll and .mly files, but if these are also .cmo/cmi files then you will have the same issue. Another (slightly crazy, but also nice) option is to create an OPAM package for the canonical implementations and then host them on a local UMD server. Then you can do:
in the |
Actually, now that I think about it, |
I think this is the best solution, because it would allow you to only distribute binaries but then also depend on them properly as a library. Although it does require someone to fashion the sets.cm* files into a findlib library. |
That definitely sounds like the best option. I'll look into doing that. Thank you so much Ian! |
Okay, I was able to create an |
Currently I'm imagining things like:
and you'd just need to do:
to register the
and everything should work out. |
Then anytime you have things you want to distribute as binary, you stick them in Doing this for p4b now to verify. |
And you can even add an OCaml version constraint for 4.04.x so that when students try to use the wrong version of OCaml, |
I've added a first crack at my idea. It's here (second commit on the branch): The basic idea is to turn any dependencies whose source you don't want to distribute into The stuff in |
As noted in your |
Yeah, in order to build the Seems strange that you can't run tests, since they should be able to be run via the compiled version just as well as the bytecode. I'll see if I can find something on this tomorrow. |
…bytecode executable for test suite, not native
@@ -1,3 +1,7 @@ | |||
(test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"test" --> "executable" will get rid of the cmxa warning.
I'd like to propose switching to the
dune
build system for OCaml. This performs the port for thep2a
project.This should not be merged! It is merely to show the diff, and spark a discussion.
Some advantages of this include:
dune
integrates with theutop
toplevel, so to test the functions in a library (say basics.ml):The only (potential) obstacle is the submit server. I'd have to investigate a bit to figure out how hard it would be to modify the submit server to accept
dune
projects. Essentially, thedune
binary would need to be available on the submit server. It is available through OPAM.Let me know what you think.