learn-ocaml
learn-ocaml copied to clipboard
`Obj` cannot be used
Hi, I am developing an exercise in which we uses a generated parser in which it uses Obj
. but it seems learn-ocaml blocks Obj
. I am wondering is there any way out of this?
Hi @HuStmpHrrr. Obj
is considered harmful, especially for beginners. For this reason, and also because it could generate safety issues when grading on the server-side, it is encouraged not to allow usage of Obj
.
Now, I guess you can still let students use Obj
by not calling ast_sanity_check
in the grader.
I don't technically want students to use it but menhir generates code using it. I guess my ultimate question is how to make code generated by menhir work on LearnOCaml (by copying the code into prepare.ml
?
to be more specific, it says Unbound module Obj
.
Hi, it is possible to use Obj in the toplevel (eg. prelude.ml
, prepare.ml
, test.ml
, TryOCaml
...)
by declaring %{ocaml-config:standard_library}/obj.cmi
in https://github.com/ocaml-sf/learn-ocaml/blob/master/src/grader/dune#L86, and then recompiling Learn-OCaml.
Furthermore, the function Test_lib.ast_sanity_check
prevents the student from using some modules (such as Obj
and Pervasives
) in his solution.