mrvn_ has quit [Read error: 60 (Operation timed out)]
Smerdya has joined #ocaml
Smerdy has quit [Read error: 110 (Connection timed out)]
GreyLensman has joined #ocaml
Smerdya is now known as Smerdyakov
TheDracle has joined #ocaml
Hanji is now known as AdiumInfoMiniste
AdiumInfoMiniste is now known as Hanji
CosmicRay has joined #ocaml
wreel has joined #ocaml
wreel has quit ["Leaving"]
shrimpx has joined #ocaml
<shrimpx>
Smerdyakov: you around>?
GreyLensman has quit ["Leaving"]
<Hanji>
Is there any central site to find OCaml modules?
<Riastradh>
The Caml hump is probably the best resource.
<Hanji>
kk, thanks
CosmicRay has quit ["Leaving"]
<Smerdyakov>
shrimpx, yes.
monochrom has quit ["hello"]
<shrimpx>
Smerdyakov: you didn't get awarded the nsf fellowship last year, did you?
<Smerdyakov>
I did.
<shrimpx>
ah cool
<Smerdyakov>
If you mean Spring 2004
<shrimpx>
yea
<shrimpx>
any advice? :) i'm finishing up my writeups
<Smerdyakov>
This isn't exactly the channel for that subject.
<shrimpx>
sorry, didn't mean to disrupt things
<vincenz>
what things
kinners has joined #ocaml
mrvn_ has joined #ocaml
mlh has quit ["who are you people and what are you doing in my computer!?"]
Maldoror has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
<vincenz>
WHat should one use for a byte-array?
vezenchio has joined #ocaml
kinners has quit [Read error: 110 (Connection timed out)]
<mrvn_>
string
<mrvn_>
A char array uses up 4/8 bytes per char plus some header I think. String just has the header.
<vincenz>
but you can store any value between 0 and 255, right?
solarwind has quit ["leaving"]
<vincenz>
(and no transformation happens)
<vincenz>
so reading into a string from a binary file and saving it again gives you an identical file
<mrvn_>
You have to use char_or_int and int_of_char if you want numbers.
<vincenz>
and do you suggest threads or nonblocking-io with select?
<vincenz>
I just meant range-wise
<mrvn_>
But yes, stings should be 1:1 binary. Not like C strings with their 0 termination.
<mrvn_>
Threads or non-blocking IO depends. How much work do you need to do between IO events?
<vincenz>
not sure yet
<vincenz>
I'm just building something which I can easily reuse
<vincenz>
right now I copied the code from the oreilly book
<mrvn_>
If you have some small input and then long jobs it might be easier to put the jobs into threads. If the jobs are small you can just use select and then work through them in one thread.
<vincenz>
why is select better?
<mrvn_>
And if you have long jobs but don't like threads you can use CPS syntax to break the jobs into small chunks and do IO inbetween.
<vincenz>
aren't threads easier?
<mrsolo>
no
<vincenz>
no?
<mrsolo>
well may be under ocaml
<mrvn_>
With multiple threads you have to synchronize between the threads. Often that is more complicated than using select.
<vincenz>
oh
<vincenz>
I dont' know
<mrsolo>
dead lock issue
<mrsolo>
#1
<vincenz>
I was thinking of using Event
<mrsolo>
hidden bugs #2
<vincenz>
so, hypothetical
<vincenz>
if I have 1000 connections...
<mrsolo>
more often or not cost of implement XXX using thread often outweights the benefits
<vincenz>
and either way, I don't know, select seems a lot more complicated
<mrvn_>
vincenz: Say you have a counter that you use to stick IDs to the jobs. Each job reads out the counter and increments it. With threads two threads might read out the counter at the same time and only then increment it. They end up with the same ID then. Stuff like that.
<vincenz>
nah
<vincenz>
just place a mutex around it
<mrsolo>
then you have scalability issue
<vincenz>
right
<vincenz>
but with select
<vincenz>
you have the issue that if one channel start something heavy, the others are blocked
<mrsolo>
not with nonblocking io
<vincenz>
with thread you've got equality of cpu-usage
<mrvn_>
vincenz: you have to design in the mutexes everywhere and if your problem needs to many of them you just end up waiting for mutexes.
<mrsolo>
yes it is less efficient then thread base..
<mrsolo>
i rather buy more hardware myself :-)
<vincenz>
yes, but if you have some sort of mud
<vincenz>
which allows people to write scripts
<mrvn_>
vincenz: yes. But if your jobs are all small or with CPS that doesn't matter.
<vincenz>
some guy could just write a script that doesn't end
<vincenz>
right now the thing I want to make is very simple
<mrvn_>
vincenz: In a mud the script compiler should produce CPS format and each job gets interrupted after X instructions and put on hold.
<vincenz>
basically you have a multiplexer
<vincenz>
program connects to otherprogrammmmm
<vincenz>
and opens a listening port
<vincenz>
so you can share the connection to the outside program
<mrvn_>
vincenz: use select
<vincenz>
mrvn_: don't tell me CPS ain't a hassle
<vincenz>
okok
<vincenz>
I will have two server-implementations
<vincenz>
with a clean exterior interface
<mrvn_>
vincenz: If you have a script language you compile anyway the compiler can easily do it,.
<vincenz>
heh, if I had to do that, I'd just implement a simplistic VM
<mrvn_>
vincenz: And in a mud you have tons of race conditions if you use threads.
<vincenz>
instead of cps
<vincenz>
okok
<vincenz>
I shall reimplement
<mrvn_>
Transforming a AST to CPS is quite easy and it makes the VM trivial.
<vincenz>
howsho?
<vincenz>
(Consider that it's 8;47 am and I'm _still_ at the office)
<mrvn_>
Because you end up with just continuation calls for everything. No subroutines, gotos and returns. Just continuations.
<vincenz>
hmmkay
<vincenz>
anywho
<mrvn_>
And you can let the user use closures easily, they are just continuations.
<vincenz>
the problem with select is that it's a push system
<vincenz>
with threads you pull
<vincenz>
anyways
<vincenz>
Igottago
<vincenz>
I'm toooooooooootired
<mrvn_>
vincenz: Make a record of { fd : Unix.fd; on_read : record -> unit; on_write : record -> unit; ...}
<vincenz>
just that with select it's push, not pull
<mrvn_>
vincenz: Each the listening socket creates those on accept and adds them to the select loop. The select loop then wait and calls the on_read/write callbacks.
<mrvn_>
You can even make the mutable so the callbacks can be changed easily.
<vincenz>
I know
<vincenz>
but if you look at it from the application-specific point of view
<vincenz>
aka this whole thing is a lib
<vincenz>
I have to let control pass out of my program
<mrvn_>
vincenz: yes.
<vincenz>
and then wait until I get called again, and remember where I was executing
<vincenz>
while with thread,s you just block on read
<vincenz>
that's why I think select is "hard"
<mrvn_>
But in your case there is nothing in the main program anyway.
<mrvn_>
Think CPS and select is prevered. :)
<mrvn_>
You could pass the select loop a continuation to call after its done or after a timeout. :)
<vincenz>
no cause the select is hidden
<vincenz>
that's part of the "socketslib"
<vincenz>
anyways, I'm too tired to think
<mrvn_>
vincenz: I'm working on my own socket lib for ocaml that is non-blocking and allows for a printf/scanf like interface. You pass it a format string and a function to call with the read values when they arrive.
<vincenz>
noice
<mrvn_>
But quite hard to write.
<mrvn_>
printf/scanf code is a bitch to understand.
<vincenz>
so you only support ascii
<vincenz>
not binary protocls
<mrvn_>
I'm even thinking about writing an extension for the Marshal module that generates format strings for any object.
<mrvn_>
No, you can say that you expect a byte, an 4 byte int, a 16byte string, a newline. All that stuff.
<vincenz>
with printf?
<vincenz>
printf/scanf are for ascii
<mrvn_>
Its a similar syntax but extended.
<vincenz>
ah
<mrvn_>
But scanf can do more in ocaml than in C already.
skylan_ has joined #ocaml
<mrvn_>
What is important for me is that you say read ('Int $ 'Short $ (String 16)) (fun a b c ->) and ocaml sees that a and b are ints and c a string.
<mrvn_>
or "%4d%2d%16s"
skylan has quit [Read error: 54 (Connection reset by peer)]
solarwind has joined #ocaml
Submarine has joined #ocaml
<vincenz>
$?
<vincenz>
infix op?
<vincenz>
and if so
<vincenz>
why is it 'Int
<vincenz>
but not 'String?
<vincenz>
either way, for the thing you're doing, you need syntax excetions
<vincenz>
extensions
pflanze has quit [Read error: 60 (Operation timed out)]
pango has quit ["Client exiting"]
pango has joined #ocaml
skylan_ has quit [Remote closed the connection]
srv has quit [Read error: 104 (Connection reset by peer)]
srv has joined #ocaml
Herrchen has joined #ocaml
karryall has joined #ocaml
mrsolo has quit ["Leaving"]
smimou has joined #ocaml
Iter has joined #ocaml
pflanze has joined #ocaml
eugos has joined #ocaml
gim has joined #ocaml
solarwind has quit [Read error: 60 (Operation timed out)]
eugos has quit ["Leaving"]
smimram has joined #ocaml
smimou has quit [Read error: 60 (Operation timed out)]
karryall has quit ["tcho"]
Demitar has quit ["Bubbles..."]
pango has quit ["Leaving"]
pango has joined #ocaml
smimram has quit ["?"]
CosmicRay has joined #ocaml
gebner has quit [Connection reset by peer]
Iter has quit [Read error: 104 (Connection reset by peer)]
mayhem has joined #ocaml
<mayhem>
yop
Herrchen has quit ["bye"]
johgro has joined #ocaml
gim has quit [Read error: 113 (No route to host)]
gim has joined #ocaml
gim has quit [Read error: 113 (No route to host)]
gim has joined #ocaml
johgro has quit ["Leaving"]
Submarine has quit ["Leaving"]
vezenchio has quit ["smile, Rakka ..."]
monochrom has joined #ocaml
pflanze has quit [Read error: 110 (Connection timed out)]