| Anonymous | Login | Signup for a new account | 2013-05-25 00:42 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0004460 | OCaml | OCaml general | public | 2007-11-30 17:04 | 2010-04-27 09:26 | |||
| Reporter | herbelin | |||||||
| Assigned To | garrigue | |||||||
| Priority | normal | Severity | major | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.10.0 | |||||||
| Target Version | Fixed in Version | 3.11+dev | ||||||
| Summary | 0004460: toplevels built with ocamlmktop do not support opening files compiled with -rectypes | |||||||
| 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?) | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0004369) jm (reporter) 2007-11-30 17:50 |
Try to add -rectypes to your custom toplevel: % ./mytop -rectypes Objective Caml version 3.10.1+dev3 (2007-11-26) # open Foo;; # HTH |
|
(0004370) herbelin (reporter) 2007-11-30 18:18 edited on: 2007-11-30 20:07 |
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. |
|
(0004371) jm (reporter) 2007-11-30 19:51 |
> Would it be possible though to do so that the custom toplevel > has automatically the recursive_types flag set? I do not see anything that could help in topdirs.mli, topmain.mli or toploop.mli. Neither any toplevel directive that would do the job. And Sys.argv could not be extended. So you may have to use a shell alias: alias mytop='mytop -rectypes' Or a shell script mytop.sh: #!/bin/sh mytop -rectypes > 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. That's because you need clflags.cmi which is not inside the binaries of ocaml (in `ocamlc -where` I mean), but if you have the sources of your ocaml in /usr/local/src/ocaml for instance, then you can do: % ocamlc -c -rectypes foo.ml % cat set_rectypes.ml let _ = print_endline "Set rectypes."; Clflags.recursive_types := true % ocamlmktop -o mytop_rectypes -I /usr/local/src/ocaml/utils set_rectypes.ml % ./mytop_rectypes Set rectypes. Objective Caml version 3.10.1+dev3 (2007-11-26) # open Foo;; # type t = t -> t;; type t = t -> t HTH |
|
(0004390) garrigue (manager) 2007-12-16 07:08 |
I think that the original report is correct. Indeed, ocamlmktop -rectypes should set the resulting toplevel to use recursive types. This is because it is unsafe to use an environment containing recursive types without the flag correctly set. But I'm not sure of how it could be implemented. One way to do it would be to put a "use_rectypes.cmo" file in the library directory, and link it if the option was given, but it looks a little hacky. |
|
(0004745) herbelin (reporter) 2008-11-14 13:22 |
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 (* parsing command line and doing some job with them, eventually leading to *) Toploop.loop Format.std_formatter % ocamlmktop -o foo -rectypes foo.ml % ./foo # 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. |
|
(0004756) glondu (reporter) 2008-11-18 23:07 |
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. |
|
(0004757) garrigue (manager) 2008-11-19 03:39 |
I've commited Stephane's patch (adding a #rectypes directive), since it seems a good thing to have anyway. It is safe, since it only allows to set -rectypes, not to unset it. Does it solve the problem for Coq? |
|
(0004763) glondu (reporter) 2008-11-19 15:31 |
Not exactly. But it is sufficient for our purposes. Thank you. |
|
(0005388) garrigue (manager) 2010-04-27 09:26 |
The fix seems to be sufficient. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2007-11-30 17:04 | herbelin | New Issue | |
| 2007-11-30 17:50 | jm | Note Added: 0004369 | |
| 2007-11-30 18:18 | herbelin | Note Added: 0004370 | |
| 2007-11-30 19:51 | jm | Note Added: 0004371 | |
| 2007-11-30 20:07 | herbelin | Note Edited: 0004370 | |
| 2007-12-06 15:38 | doligez | Status | new => acknowledged |
| 2007-12-16 07:02 | garrigue | Status | acknowledged => assigned |
| 2007-12-16 07:02 | garrigue | Assigned To | => garrigue |
| 2007-12-16 07:08 | garrigue | Note Added: 0004390 | |
| 2008-11-14 13:22 | herbelin | Note Added: 0004745 | |
| 2008-11-18 23:07 | glondu | Note Added: 0004756 | |
| 2008-11-18 23:07 | glondu | File Added: toprectypes.diff | |
| 2008-11-19 03:39 | garrigue | Note Added: 0004757 | |
| 2008-11-19 03:39 | garrigue | Status | assigned => acknowledged |
| 2008-11-19 15:31 | glondu | Note Added: 0004763 | |
| 2010-04-27 09:26 | garrigue | Note Added: 0005388 | |
| 2010-04-27 09:26 | garrigue | Status | acknowledged => closed |
| 2010-04-27 09:26 | garrigue | Resolution | open => fixed |
| 2010-04-27 09:26 | garrigue | Fixed in Version | => 3.11+dev |
| Copyright © 2000 - 2011 MantisBT Group |