Version française
Home     About     Download     Resources     Contact us    
Browse thread
Trouble Defining an Object
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Trouble Defining an Object
On Thursday 08 September 2005 19:12, Paul Snively wrote:
> # #require "sdl.sdlmixer";;
> /usr/local/lib/ocaml/site-lib/sdl: added to search path
> /usr/local/lib/ocaml/site-lib/sdl/sdlmixer.cma: loaded
> # open Sdlmixer;;
> # open Filename;;
> # class foo init_song =
>    let name, chan = open_temp_file ~mode:[Open_binary] "foo" "bar" in
>      output_string chan init_song;
>      close_out chan;
>      let the_song = load_music name in
>        object
>      val mutable song = the_song
>        end;;

Perhaps you want:

class foo init_song =
  let name, chan = open_temp_file ~mode:[Open_binary] "foo" "bar" in
  let () =
    output_string chan init_song;
    close_out chan in
  let the_song = load_music name in
object
  val mutable song = the_song
end;;

or even:

let foo init_song =
  let chan = open_out "foo" in
  let () =
    output_string chan init_song;
    close_out chan in
  let the_song = load_music name in
object
  val mutable song = the_song
end;;

But I'm not sure...

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists