You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 2301 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I found a workaround (which is strange, IMHO) to the problem showed by the bug #1921.
Here is a reminder:
##################################################
let rec recData=
let module SomeModule=
struct
let callRecData x=
if x<=0
then 1
else ((fst recData) (x-1)) * x
let mk_double x=2 * x
end
in
(SomeModule.callRecData, SomeModule.mk_double)
let _=
let test=(snd recData) ((fst recData) 5) in
print_int test
##################################################
This code compiled against 3.06 and worked as expected, while 3.07 refused it
(this kind of expression not allowed in the right-hand side of a 'let rec'...).
Here's the workaround:
##################################################
let rec recData dummy=
let module SomeModule=
struct
let callRecData x=
if x<=0
then 1
else ((fst (recData dummy)) (x-1)) * x
let mk_double x=2 * x
end
in
(SomeModule.callRecData, SomeModule.mk_double)
let _=
let test=(snd (recData [])) ((fst (recData [])) 5) in
print_int test
###################################################
As you see, the solution is to add one useless parameter to make 3.07 happy (and
the execution is also correct). I didn't look after the problematic piece of
code in the OCaml source code, though.
The text was updated successfully, but these errors were encountered:
Original bug ID: 2301
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I found a workaround (which is strange, IMHO) to the problem showed by the bug
#1921.
Here is a reminder:
##################################################
let rec recData=
let module SomeModule=
struct
in
(SomeModule.callRecData, SomeModule.mk_double)
let _=
let test=(snd recData) ((fst recData) 5) in
print_int test
##################################################
This code compiled against 3.06 and worked as expected, while 3.07 refused it
(this kind of expression not allowed in the right-hand side of a 'let rec'...).
Here's the workaround:
##################################################
let rec recData dummy=
let module SomeModule=
struct
in
(SomeModule.callRecData, SomeModule.mk_double)
let _=
let test=(snd (recData [])) ((fst (recData [])) 5) in
print_int test
###################################################
As you see, the solution is to add one useless parameter to make 3.07 happy (and
the execution is also correct). I didn't look after the problematic piece of
code in the OCaml source code, though.
The text was updated successfully, but these errors were encountered: