-
Notifications
You must be signed in to change notification settings - Fork 66
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
Question: what is the 1.0 alternative to private grader helper modules a la depend.txt? #588
Comments
Indeed, sharing code between graders now requires the definition of a library; but that's much simpler than it seems, and it doesn't need to be user-facing. We'll improve the documentation regarding that. The easiest way is to use (library
(name mytestlib)
(public_name mytestlib)
(wrapped false)
(modes byte)
(libraries learn-ocaml.test_lib)
(flags (:standard -open Test_lib.Open_me))
(preprocess (action (run %{libexec:learn-ocaml.test_lib:grader-ppx} %{input-file})))) Then run The major benefit of this approach is that your helper module is compiled just once and re-used by every exercise, instead of being recompiled for each one of them. Thanks a lot for reporting, I will be waiting for your feedback on the above info to update the docs. |
FWIW, there is a comprehensive example here: @AltGr |
@AltGr @erikmd Thanks for your responses. I made some progress with the suggested approach, but don't have things working yet because of the many helper modules I need to port. Do you recommend that I create a separate dune project for each helper module? Feels very heavy, but not sure it's possible otherwise. |
Also, I guess this means I need to repeat this dune installation across different machines if I want to keep my modules private, correct? I usually develop LearnOCaml exercises locally but we run our LearnOCaml server on a dedicated machine on campus. |
I guess that for this example they don't use the preprocessor, because they only provide helper functions that don't need it ?
You should be fine with one dune project providing a single OCaml library that bundles all your modules
If you want to run |
Related user(s):
@AltGr
Related issue(s) or PR(s):
#481
Related project scope(s):
grading, test_lib
Question?
Tried upgrading to LearnOCaml 1.0 (after over a year), found that my existing grader code for some exercises could no longer be broken up into separate files using
depend.txt
. It looks like this was removed in favor oftest_libs.txt
in #481, which requires that I make my grader code available as a library via findlib. I'm not familiar with this process, but from what I skimmed online, it seems a more public-facing option than seems warranted in my case -- I just want to keep many lines of messy datatype samplers and buggy solutions out of my way. Am I misunderstanding thetest_libs.txt
solution? If not, is there another alternative closer todepend.txt
?What has already been tested:
No response
learn-ocaml --version
1.0.0
git describe --long --always --abbrev=40 --tags
No response
What OS do you use?
GNU/Linux, MacOS
What browser(s) do you use with learn-ocaml?
Chromium
Additional context:
No response
The text was updated successfully, but these errors were encountered: