whee has joined #ocaml
whee has quit ["Leaving"]
TimFreeman has left #ocaml []
<exa> smkl: 'k. thanks
exa is now known as exa-away
gene9 has joined #ocaml
gene9 has quit ["Client Exiting"]
malc has joined #ocaml
malc has quit ["no reason"]
two-face has joined #ocaml
<two-face> hello
<two-face> anybody alive in there ?
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
<two-face> anybody alive in there ?
malc has joined #ocaml
<two-face> hi malc
<malc> lo two-face
<two-face> I know you are kinda Ocaml ace
<two-face> I would have some questions about interfacing with C
<malc> i am? how come? but anyway i can try to answer the questions, though my exposure to C interfacing is limited
<two-face> ah.
<two-face> I need to know how to handle NULL pointers in Ocaml :p
<two-face> I mean Null C pointers
<malc> Well, uh, you cant do anything with pointers in OCaml so your question escapes me. provide more background
<two-face> well
<two-face> Assume you're programming an Ocaml binding for a given C lib
<two-face> and a given C function takes a pointer in permater
<two-face> and that the NULL value is significant to the C function
<two-face> I'd like to know how to handle the NULL value in OCaml
<malc> Okay
<malc> Let's see
<malc> First of all, since you can not create pointer in OCaml itself it must come from C code
<malc> wraped in some custom block
<two-face> yup
<malc> And you can not modify it in OCaml either
<two-face> yes
<malc> So the answer lies in your C bindings
<two-face> hmm?
<malc> You either instruct C functions that they should set this pointer to null or use some sort of union/polyvariant type and again C sets the param to NULL
<two-face> perhaps I have to define some type in Ocaml for pointers like type foo = Null | NotNull of pointer ?
<malc> that's what i just said, yes
<malc> but again all this sort of depends on your settings
<two-face> hmmm
<malc> try looking at some libraries that do heavy C interfacing
<malc> lablgtk
<malc> mlgmp
<two-face> that's what I did, but well, I'm not familiar with the Obj module
<malc> GREAT!
<malc> This is very very good ;)
<two-face> huh ?
<two-face> what ? :=)
<malc> It's evil
<malc> And should _never_ be used
<malc> Though everyone does use it at one point or another :)
<two-face> yes, but Ocaml team knows the magic
<two-face> and do want to tell us
<malc> There are really few cases when Obj is legit, and misuse can have catastrophic consequences
<two-face> I guess so
<two-face> Printf, for instance, wouldn't exist without, I guess
<malc> I can only suggest starting coding your interface they solution will present itself once you realize the problem in full
<malc> yep
<two-face> ok
<two-face> I will probably raise the question in the lsit
<two-face> list
<malc> good idea
<two-face> Ok Ok
<two-face> thanks bye
<malc> n/p
two-face has quit ["Client Exiting"]
yangsx has joined #ocaml
yangsx has quit ["Client Exiting"]
exa-away is now known as exa
yangsx has joined #ocaml
<yangsx> hi, can anybody explain why this line gives me error: This expression has type in_channel but is here used with type unit
<yangsx> let line = read_line ic in
<yangsx> ^^
<malc> yangsx: use input_line
<malc> # read_line;;
<malc> - : unit -> string = <fun>
<malc> reads from stdin
<malc> # input_line;;
<malc> - : in_channel -> string = <fun>
<yangsx> thanks, i'm not careful enough.
malc has quit ["no reason"]
yangsx has quit ["Client Exiting"]
gl has quit [Read error: 113 (No route to host)]
gl has joined #ocaml
exa has left #ocaml []
skylan_ has joined #ocaml
skylan has quit [Connection timed out]
malc has joined #ocaml
skylan_ has quit [Read error: 104 (Connection reset by peer)]
skylan_ has joined #ocaml
skylan_ has quit [Read error: 104 (Connection reset by peer)]
skylan_ has joined #ocaml