Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005054OCaml~DO NOT USE (was: OCaml general)public2010-05-19 03:032010-05-20 16:57
Assigned To 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version3.12.0+dev 
Summary0005054: simple recursive value not accepted
DescriptionI can't think of any reason this should fail, and the documentation about "statically constructive" expressions would seem to allow it.

jeremy:~$ ocamlc -c
File "", 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
  type t
  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 InformationOn Snow Leopard.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
frisch (developer)
2010-05-19 13:34
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 ( [^] ) 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.

doligez (administrator)
2010-05-20 16:31

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.
doligez (administrator)
2010-05-20 16:57

OK. Seems to work, and I'm reasonably confident that it's sound.

- Issue History
Date Modified Username Field Change
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
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker