WhatTheDeuce has quit [Read error: 104 (Connection reset by peer)]
WhatTheDeuce has joined #ocaml
bohanlon has joined #ocaml
WhatTheDeuce has left #ocaml []
Snark has joined #ocaml
vitriol_ has joined #ocaml
chessguy has quit [Connection timed out]
<vitriol_>
has anyone ever used ocaml to embed an extension language in a C program?
<flux__>
I had tried to do that with irssi
<flux__>
it is far from complete, but I think it technically works.. or maybe worked last time I worked on it :)
bluestorm has joined #ocaml
<bluestorm>
hello wolrd
<bluestorm>
could someone explain me how i may stop a Unix.accept ?
<vitriol_>
flux__, oh that's cool
<bluestorm>
i have a thread running accept, and i would like to have a fonction that stop that accept, and then execute some part of code in the thread that was doing the accept
<vitriol_>
flux__, so there are patches for irssi?
<bluestorm>
(i mean, just kill the thread isn't what i'm looking for)
<flux__>
I haven't released anything, maybe I should, even if they aren't really usable yet
<bluestorm>
hum
<flux__>
if you're interested, though, I can provide patches
<bluestorm>
Could i use a Unix.select before the accept ?
<flux__>
there's a way to do nonblocking connect with select, yes
<bluestorm>
hum
<flux__>
there was a related bug in some ocaml version though, it might be fixed in present versions
<flux__>
however, the idea is to set the socket into non-blocking state
<flux__>
and then connect
<bluestorm>
i never used select and the doc isn't very verbose about that
<bluestorm>
hum
<flux__>
and when the socket is ready for write (??), do it again
<flux__>
it will throw Unix_error (EINPROGRESS, _, _) when it's still doing the connection
<flux__>
google will find you actual examples on the subject
<flux__>
atleast I think I've provided sufficiently many keywords :)
<bluestorm>
:p
<flux__>
if you need documentation in general how select is supposed to be used, check out libc info pages
<bluestorm>
hum
<flux__>
I believe it has some examples. if not, refer to google, it _must_ have dozens of examples.
<bluestorm>
ok
<bluestorm>
i didn't looked for C-ish examples
<bluestorm>
i'm gonna do it now
<flux__>
yeah, for more documentation on how stuff in the Unix-module is supposed to work, it's a good idea to search for C-stuff
<flux__>
as they in principle are the same
<vitriol_>
flux__, i would be quite interested in those patches...
<flux__>
ok, I'll see if I remember how to extract stuff from svk.. :)
<zmdkrbou>
pango: there's been quite a lot of work about first class modules ... for examples mixins, but it won't be introduced in ocaml
<Smerdyakov>
z|away, can you give broader context of what you are trying to accomplish?
<zmdkrbou>
it doesn't work that good, it seems ... :s
<metaperl>
class-based oop keeps trying to be an OK easy to use version of prototyped-based oop in my eyes... roles, traits, mixins, first-class modules, etc...
<metaperl>
it's happening in Perl too -- meta-object protocols for classes and more... just because prototyped-based OO gets overlooked
<Smerdyakov>
metaperl, have you actually implemented any serious software in a non-Perl language?
<metaperl>
no. not since my M.S. degree in 1993 have I done anything serious outside of Perl
<mellum>
I don't think that modules as in Ocaml have much to do with "OO"
<metaperl>
oh
<Smerdyakov>
metaperl, OK, so I don't see how you're qualified to discourse on prototype-based OO. :P
<mellum>
Except that in languages specializing on OO you would use OO mechanism to achieve the same
<metaperl>
Smerdyakov: it speaks for itself. one is a subset of the other. the subset is convenient but gets itself into trouble
<zmdkrbou>
if modules were OO in ocaml there wouldn't an "o" added to the "caml" name :)
<Smerdyakov>
And I can add extra useless features to any language. What's your point?
<dylan>
there's a patch for first class modules in ocaml, I think.
<z|away>
Smerdyakov: Not really, I'm just modifying existing code which uses "let X = module V in X.doStuff x y z ..." but I need to conditionally use Y.doStuff x y z... and was hoping for a quick way to do it.
<dylan>
it'd be neat if modules were first class, as functors and functions would be the same.
<ketty>
z|away: maybe you can set V to Y before that part?
bluestorm has quit [Remote closed the connection]
<z|away>
ketty: I don't think that works either.
<ketty>
ohh.. so you sometimes want to use X.stuff and sometimes Y.stuff...
<z|away>
yes
<ketty>
you could use a functor..
<ketty>
on the part "doingStuff"
<ketty>
but you need to know which of the two you want when you call functions etc..
<ketty>
so, i guess there is no really easy way...
<ketty>
except using objects :)
<z|away>
Sure.. or a mass copy & paste. Ah well.
<ketty>
yeah, that is an option too :)
<pango>
what about writing calling code as a functor, instanciate it with X, and with Y, then use one instance or the other based on b ? Whether it's practical really depends on usage, however
<Smerdyakov>
z|away, that's not enough context to see what would make sense if writing the program from scratch.