Version française
Home     About     Download     Resources     Contact us    
Browse thread
let x = ... in object ...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] let x = ... in object ...
Guillaume Hennequin wrote:
> Dear list,
> 
> I was just wondering whether in
> 
> class a =
>   let x = Array.make 10000 0. in
> object
>   val y = Array.copy x
>   ...
> end

# class a = let () = print_endline "hello" in object end;;
hello
class a : object  end


Maybe you mean the following:

class a () =
  let x = Array.make 10000 0. in
object
  val y = Array.copy x
  ...
end


> x will be garbage collected or not.
> (this is just an example, I know creating x and copying is just doesn't
> make sense, but I wanted to point out that in my case, x doesn't need to
> be kept, but just used during object creation. I would like it to be
> garbage collected).
> I roughly recall a previous post where I think the reply was
> "intermediate values such as x are "kept" as members of the class", but
> I'm not sure.
> 
> Thanks
> 
> Guillaume.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


-- 
http://mjambon.com/