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: 1461 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Dr. Lee Hunt McDonald
Version: OCaml 3.02 and 3.06
OS: RedHat 8.0 Linux
Submission from: dsl093-162-077.tus1.dsl.speakeasy.net (66.93.162.77)
I ran the following code with OCaml 3.02 (CDK) and OCaml 3.06.
The output shows that there is a bug here.
class bad =
object
(* ---- instance variables ---- *)
val mutable myMutStr = "11";
(* ---- setters ---- *)
method chgStr : unit =
begin
myMutStr.[0] <- '2';
myMutStr.[1] <- '2';
end;
method backStr : unit = myMutStr <- "11";
(* ---- getters ---- )
method getStr : string =
begin
myMutStr;
end;
end ( end class bad *)
(*
-------- functional stuff for unit testing -------- )
let _ =
if !(Sys.interactive) then
()
else begin
print_string "Bad behavior v0.00";
print_newline ();
let jj = new bad
in begin
jj#chgStr;
jj#backStr;
let x1 = jj#getStr
in begin
print_string ("1st =" ^ x1);
print_newline ();
end;
jj#chgStr;
jj#backStr;
let x1 = jj#getStr
in begin
print_string ("2nd =" ^ x1);
print_newline ();
end;
end;
end ( end else *)
----------- end code ---------------
----------- start shell script : this is how I compiled bad.exe -----------
#!/bin/sh
ocamlc -g -c bad.ml
ocamlc -g -o bad.exe bad.cmo
---------- end shell script ----------
----------- start output (from running bad.exe) -----------
Bad behavior v0.00
1st =11
2nd =22
----------- end output -----------
The text was updated successfully, but these errors were encountered:
Original bug ID: 1461
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Dr. Lee Hunt McDonald
Version: OCaml 3.02 and 3.06
OS: RedHat 8.0 Linux
Submission from: dsl093-162-077.tus1.dsl.speakeasy.net (66.93.162.77)
I ran the following code with OCaml 3.02 (CDK) and OCaml 3.06.
The output shows that there is a bug here.
---------- start code -------------
(* BAD.ML : string bug *)
class bad =
object
(* ---- instance variables ---- *)
val mutable myMutStr = "11";
(* ---- setters ---- *)
method chgStr : unit =
begin
myMutStr.[0] <- '2';
myMutStr.[1] <- '2';
end;
method backStr : unit = myMutStr <- "11";
(* ---- getters ---- )
method getStr : string =
begin
myMutStr;
end;
end ( end class bad *)
(*
)
let _ =
if !(Sys.interactive) then
()
else begin
print_string "Bad behavior v0.00";
print_newline ();
let jj = new bad
in begin
jj#chgStr;
jj#backStr;
let x1 = jj#getStr
in begin
print_string ("1st =" ^ x1);
print_newline ();
end;
jj#chgStr;
jj#backStr;
let x1 = jj#getStr
in begin
print_string ("2nd =" ^ x1);
print_newline ();
end;
end;
end ( end else *)
----------- end code ---------------
----------- start shell script : this is how I compiled bad.exe -----------
#!/bin/sh
ocamlc -g -c bad.ml
ocamlc -g -o bad.exe bad.cmo
---------- end shell script ----------
----------- start output (from running bad.exe) -----------
Bad behavior v0.00
1st =11
2nd =22
----------- end output -----------
The text was updated successfully, but these errors were encountered: