kinners has quit [Read error: 113 (No route to host)]
mrsolo_ has quit [Read error: 60 (Operation timed out)]
bk_ has joined #ocaml
shawn has joined #ocaml
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
noss has joined #ocaml
tyler has joined #ocaml
sundeep has joined #ocaml
Snark has joined #ocaml
<Snark>
slt
urz has joined #ocaml
<urz>
hi
<urz>
i need help
<Snark>
urz: you're on irc: don't ask to ask
<urz>
i want to use a varient type in another module but it says "Unbound constructor"
<urz>
do i need to use some kind of "import" or "use" or "include" or something?
<urz>
he constructor is Welcome
<urz>
should i say module.Welcome
<urz>
?
<mellum>
urz: yes
<urz>
is there away to put it into the current namespace?
<mellum>
or rather, Module.Welcome
<mellum>
urz: probably, but I'd advise against that. It helps a lot if you always know unqualified identifiers must be from the current module.
sundeep has quit [Client Quit]
sundeep has joined #ocaml
sdf223 has joined #ocaml
sdf223 has quit [Client Quit]
gim has joined #ocaml
<Demitar>
urz, you could "open Module" but that puts all identifiers in the current namespace and is generally bad practice. If it is really a hassle you might want to consider using polymorphic variants.
<urz>
thanks
<urz>
theres no open Module.blah eh?
<urz>
heh
urz has quit ["No windows for this server"]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
trch has quit ["Client exiting"]
__DL__ has joined #ocaml
Riastradh has quit [Read error: 60 (Operation timed out)]
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
kosmikus|away is now known as kosmikus
Axioplase has joined #ocaml
<Axioplase>
Chat Lu!
Riastradh has joined #ocaml
arnowa__ has joined #ocaml
arnowa_ has quit [Read error: 110 (Connection timed out)]
__DL__ has quit ["Bye Bye"]
lowks has joined #ocaml
<lowks>
can i do a 'open Tk;;' from the interactive ?
phj has joined #ocaml
<phj>
Which development tools of cygwin should be installed for ocaml windows developing envrioment?
<phj>
I'm using native win32 port built with Mingw.
Demitar has quit [Read error: 104 (Connection reset by peer)]
mattam_ is now known as mattam
Axioplase is now known as Axio|Fac
sproctor has joined #ocaml
seg|sleep is now known as segphault
JaffaCake has joined #ocaml
<JaffaCake>
is there anyone here who can answer a couple of questions about calling C from ocaml, in particular with respect to threads?
<Banana>
JaffaCake: yes ? (at least I can try to answer :) )
<JaffaCake>
right, here goes... so if I want to call a foreign function that might block, I have to wrap it in enter_blocking_section()/leave_blocking_section(), right?
<Banana>
yes.
<JaffaCake>
and this only works when using native threads
<Banana>
you mean your enter/leave_blocking_section are on the C side ?
<JaffaCake>
yes
<Banana>
so they acquire a lock on entering and release it on leaving.
<Banana>
and the lock is a data in the C world.
<JaffaCake>
the other way around, I think: enter_blocking_section() releases the lock on the caml system
<JaffaCake>
so that another thread can run while the call is in progress
<Banana>
imho you should handle thread only in one side.
<Banana>
(the ocaml would be the best).
<Banana>
you can lock in the ocaml code then call your C function.
<JaffaCake>
no, I have a multithreaded caml program that needs to call a C function that blocks
<Banana>
yes.
<JaffaCake>
and the other caml threads have to continue
<Banana>
then call this function in a separate thread.
<JaffaCake>
yes... but it looks like in order to release the lock, you have to call enter/leave_blocking_section() around the call
<JaffaCake>
otherwise all the other threads are blocked during the call
<Banana>
hum...
<JaffaCake>
looking at the source code for Unix.read and friends
<JaffaCake>
that's what they do
<JaffaCake>
anyway, you don't have to tell me, I'm a Haskell spy after all ;)
<Banana>
ha ha.
<Banana>
does your C function blocks because of eg waiting for an input or because it has to wait for another lock to be released by another thread ?
<JaffaCake>
blocks on IO
<Banana>
then you start it in a separate thread, other threads that needs the input data are of course waiting and threads that have nothing to do with it run concurrently...
<Banana>
i don't see the problem.
<Banana>
when you call leave_blocking_section(), threads waiting for the data will go on.
<JaffaCake>
yes, I get that bit
<JaffaCake>
but you *must* call enter_blocking_section() before calling the C function
<JaffaCake>
and leave_blocking_section() afterward
<Banana>
yes of course.
<JaffaCake>
right, now what if the C function makes a callback to ocaml?
<JaffaCake>
it needs to call leave_blocking_section() first, right/
<JaffaCake>
?
<Banana>
i don't see why.
<mellum>
JaffaCake: you are *really* desperate for debugging nightmares, aren't you?
<JaffaCake>
mmm, not really, just wondering how ocaml handles this stuff
<Banana>
i guess your enter_blocking section is just an Mutex.lock m where m is global variable containing a mutex.
<JaffaCake>
it's not *my* enter_blocking_section(), it's part of the ocaml runtime
<Banana>
?
<Banana>
where is it defined ?
<JaffaCake>
otherlibs/systhreads/posix.c
<JaffaCake>
and asmrun/signals.c
<JaffaCake>
and look for an example of its use in otherlibs/unix/read.c
<Banana>
I don't think you are supposed to call them.
<JaffaCake>
ok... so my question is then how do I make a call to a blocking C function, without blocking the other ocaml threads?
<Banana>
your C function (blocking or not) is defined in the Ocaml side by an external definition right ?
<JaffaCake>
yep
<Banana>
then juste create a thread with it.
<Banana>
let mythread =Thread.create (f) (data)
<JaffaCake>
hmm, I don't think that works
<Banana>
why not ?
<JaffaCake>
I'll get back to you
* JaffaCake
thinks he better actually try it, rather than just read the ocaml source code :)
<Banana>
JaffaCake: just a thing...
<Banana>
if you need to guard your function then uses the Mutex module.
<Banana>
in the ocaml side.
<JaffaCake>
ok, thanks
<Banana>
bbl.
* Banana
is out buying a new keyboard.
lowks has quit [Read error: 104 (Connection reset by peer)]
monotonom has quit ["Don't talk to those who talk to themselves."]
ne1 has joined #ocaml
<Submarine>
what do you mean "not interchangeable"?
<Submarine>
ah, the second is illegal syntax?
<Submarine>
OCaml has a somewhat simplistic view of modules whereas all symbols should be mapped to absolute paths, if I'm not mistaken.
<Riastradh>
Because (Acc.Algorithms)(CoreAccImpl) is not a normal OCaml expression.
<dobrek>
Submarine: I would like not to have to define this ColAccAlgs
<Submarine>
So any type or term should be mappable to a unique path.
<dobrek>
Riastradh: I know I cannot compile it :))
<Submarine>
That's because, for instance, OCaml distinguishes two distinct abstract types by their paths.
<Submarine>
If you do:
<Submarine>
module M1 = A(B)
<Submarine>
module M2=A(B)
<Submarine>
and A(X) contains some abstract type t
<Submarine>
then I suspect that M1.t and M2.t are distinct.
<Submarine>
You may consider using the let module ... in construct.
<dobrek>
Submarine: I know I read this modular moduel system paper of Xavier. But I was trying not to use this let module ... in. Now I think I get why I have to but I am not quite shure.
<dobrek>
I mean I think I know why I have to "use let... in construct ". And don't bother I am not quite shure :))
<Submarine>
dobrek: Well, you now understand why Judicael Courant was unhappy about this module system.
rox has joined #ocaml
<Submarine>
There are other reasons why there cannot be transparential reference to modules.
<Submarine>
For instance, module instanciating has side effects.
<dobrek>
Submarine: Do you know any paper where it is disscussed in more detailes. I mean mainly the drawbacks of this system ?
<Submarine>
Not off the top of my hand. I suspect that Xavier has a bibliography online.
<Submarine>
head, not hand
Submarine has left #ocaml []
<dobrek>
I am pretty new to ocaml anyway. I see I have to read a bit more. Thanks anyway.