|Anonymous | Login | Signup for a new account||2015-04-01 10:06 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005054||OCaml||OCaml general||public||2010-05-19 03:03||2010-05-20 16:57|
|Target Version||Fixed in Version||3.12.0+dev|
|Summary||0005054: simple recursive value not accepted|
|Description||I can't think of any reason this should fail, and the documentation about "statically constructive" expressions would seem to allow it.|
jeremy:~$ ocamlc -c minimal.ml
File "minimal.ml", line 18, characters 21-53:
Error: This kind of expression is not allowed as right-hand side of `let rec'
module type POINTED_SET = sig
val x : t
module IntWith3 : POINTED_SET = struct
type t = int
let x = 3
(* all of these are fine *)
let rec silly_list = (IntWith3.x :: silly_list)
let rec silly_list = (Some IntWith3.x :: silly_list)
let rec silly_list = ([ IntWith3.x ] :: silly_list)
let rec silly_list = (ref IntWith3.x :: silly_list)
(* but this causes an error! *)
let rec silly_list = ([| IntWith3.x |] :: silly_list)
|Additional Information||On Snow Leopard.|
|Tags||No tags attached.|
edited on: 2010-05-19 13:34
This is caused by this case in Translcore.check_recursive_lambda:
| Lprim (Pmakearray (Pgenarray), args) -> false
This was introduced in rev 7742 ( http://caml.inria.fr/cgi-bin/viewcvs.cgi/ocaml/version/3.09/bytecomp/translcore.ml?rev=7742&r1=7175&r2=7742 [^] ) as part of the fix for 0004141.
Damien: do you remember the reason for this case? It seems to me that the default behavior (accepting the array expression if it does not refer to any variable defined in the current let-rec) should be sound.
I don't remember exactly, but looking at the code I see there is a trap with generic arrays:
you don't know their size because it depends on their type (float or not).
This pattern should probably be moved up to check_top, and then we can do better than
the default case by doing the same as for other arrays (just check all the arguments).
I'll implement that and do some testing.
OK. Seems to work, and I'm reasonably confident that it's sound.
|2010-05-19 03:03||jeremy||New Issue|
|2010-05-19 13:34||frisch||Note Added: 0005457|
|2010-05-19 13:34||frisch||Note Edited: 0005457|
|2010-05-20 16:31||doligez||Note Added: 0005472|
|2010-05-20 16:57||doligez||Note Added: 0005475|
|2010-05-20 16:57||doligez||Status||new => closed|
|2010-05-20 16:57||doligez||Resolution||open => fixed|
|2010-05-20 16:57||doligez||Fixed in Version||=> 3.12.0+dev|
|Copyright © 2000 - 2011 MantisBT Group|