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: 4426 Reporter: jm Status: closed (set by @garrigue on 2007-10-29T06:57:54Z) Resolution: fixed Priority: normal Severity: major Platform: i686 OS: Debian OS Version: Sid Version: 3.10+dev Fixed in version: 3.10+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: jm
Bug description
In the example below, the optional argument ?l of class ko shouldn't be memorized at the first instantiation.
Steps to reproduce
% ocaml
Objective Caml version 3.10.1+dev0 (2007-05-21)
class i ?(l=fun () -> 0) () =
object val v = l () method v = v
initializer prerr_endline ("v="^string_of_int v)
end;;
class i : ?l:(unit -> int) -> unit -> object val v : int method v : int end
class ko ?l = i ~l: (fun () -> (object inherit i () ?l end)#v + 1)
class ok ?l = i ~l: ((fun ?l () -> (object inherit i () ?l end)#v + 1) ?l)
;;
class ko : ?l:(unit -> int) -> unit -> i
class ok : ?l:(unit -> int) -> unit -> i
new ko () ~l: (fun _ -> 42);;
v=42
v=43
: ko =
new ko ();;
v=42
v=43
: ko =
new ko () ~l: (fun _ -> 24);;
v=42
v=43
: ko =
new ok () ~l: (fun _ -> 42);;
v=42
v=43
: ok =
new ok ();;
v=0
v=1
: ok =
new ok () ~l: (fun _ -> 24);;
v=24
v=25
: ok =
The text was updated successfully, but these errors were encountered:
Original bug ID: 4426
Reporter: jm
Status: closed (set by @garrigue on 2007-10-29T06:57:54Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: i686
OS: Debian
OS Version: Sid
Version: 3.10+dev
Fixed in version: 3.10+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: jm
Bug description
In the example below, the optional argument ?l of class ko shouldn't be memorized at the first instantiation.
Steps to reproduce
% ocaml
Objective Caml version 3.10.1+dev0 (2007-05-21)
class i ?(l=fun () -> 0) () =
object val v = l () method v = v
initializer prerr_endline ("v="^string_of_int v)
end;;
class i : ?l:(unit -> int) -> unit -> object val v : int method v : int end
class ko ?l = i ~l: (fun () -> (object inherit i () ?l end)#v + 1)
class ok ?l = i ~l: ((fun ?l () -> (object inherit i () ?l end)#v + 1) ?l)
;;
class ko : ?l:(unit -> int) -> unit -> i
class ok : ?l:(unit -> int) -> unit -> i
new ko () ~l: (fun _ -> 42);;
v=42
v=43
new ko ();;
v=42
v=43
new ko () ~l: (fun _ -> 24);;
v=42
v=43
new ok () ~l: (fun _ -> 42);;
v=42
v=43
new ok ();;
v=0
v=1
new ok () ~l: (fun _ -> 24);;
v=24
v=25
The text was updated successfully, but these errors were encountered: