-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
toplevels built with ocamlmktop do not support opening files compiled with -rectypes #4460
Comments
Comment author: jm Try to add -rectypes to your custom toplevel: % ./mytop -rectypes open Foo;;HTH |
Comment author: herbelin Adding -rectypes to the custom toplevel command line works for the simple problem mentioned above but not in the more general case (which is in fact our real case) where the custom toplevel has its own parser for the arguments of the command line . Would it be possible though to do so that the custom toplevel has automatically the recursive_types flag set? I tried to add Clflags.recursive_types := true in foo.ml but I couldn't get the Clflags module visible when compiling foo.ml, even with toplevellib.cma loaded. Thanks in advance. |
Comment author: jm
So you may have to use a shell alias:
% ocamlmktop -o mytop_rectypes -I /usr/local/src/ocaml/utils set_rectypes.ml open Foo;;type t = t -> t;;type t = t -> t HTH |
Comment author: @garrigue I think that the original report is correct. Indeed, |
Comment author: herbelin Here is an update to the -rectypes issue with ocamlmktop that I submitted for ocaml 3.10. For debugging purposes of the coq software, we do on-demand calls to the ocaml toplevel loop as in the following configuration: % cat foo.ml type t = t -> t;;which fails since 3.10. We know about the Cflags-linking workaround but it requires the ocaml sources. We know another hack which is to cheat with Sys.argv, setting all arguments to "-rectypes" and using a call to Topmain.main to activate the Cflags.recursive_types option, but this needs to have at least one true argument in Sys.argv. Will there be cleaner alternatives with 3.11? Thanks in advance. |
Comment author: @glondu Another possibility would be to add a new toplevel directive #rectypes. This seems to be a quite well-established way to alter command line options from within a toplevel. Attached is patch implementing this. |
Comment author: @garrigue I've commited Stephane's patch (adding a #rectypes directive), since it seems a good thing Does it solve the problem for Coq? |
Comment author: @glondu Not exactly. But it is sufficient for our purposes. Thank you. |
Comment author: @garrigue The fix seems to be sufficient. |
Original bug ID: 4460
Reporter: herbelin
Assigned to: @garrigue
Status: closed (set by @garrigue on 2010-04-27T07:26:33Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.10.0
Fixed in version: 3.11+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu
Bug description
This looks similar to bug report 4402 with ocamlmktop instead of ocamldebug.
The following script allows to reproduce the problem.
#touch foo.ml
#ocamlc -c -rectypes foo.ml
#ocamlmktop -o mytop
#mytop
open Foo
Unit Foo imports from , which uses recursive types.
The compilation flag -rectypes is required
Adding option -rectypes to ocamlmktop does not change anything (maybe should it? or has topmain.ml to systematically set Clflags.recursive_types to true?)
File attachments
The text was updated successfully, but these errors were encountered: