__DL__ has quit [Read error: 104 (Connection reset by peer)]
<barfoos>
How can I copy stdin to a file without implementing busywaiting? Is there a way to bind an action to a signla, such that this action will always be called, when there is something on stdin?
<pango_>
a thread ?
<barfoos>
good idea. but i don't want to put the thread into an endlessloop, whish will occupy my cpu.
<dan2>
barfoos: nonblocking i/o
<pango_>
in the thread you use the usual blocking read()
<barfoos>
ah i see
<barfoos>
thanks.
<barfoos>
by the way: is this actualy the right channel to post such questions? or is this more a channel about the internas of ocaml?
<dan2>
we answer all questions we can
<dan2>
because ideally people who show up here aren't too stupid
<dan2>
:)
<barfoos>
i'm pretty new to ocaml. and you probalby would not be wrong to suggest to me to go and read a book about it before asking questions here. problem is that i did not have the time to read such a book, but i got a task to solve, so i'm very pleased to have got such short and preciese answers. thanks.
<dan2>
are you using ocaml to solve the problem?
<barfoos>
yes
<dan2>
:)
<dan2>
as a language, ocaml is amazing ...
<dan2>
maximizing expressiveness
<dan2>
let sum (a,b) = a + b
<dan2>
that would take an int tuple and return the sum of digits ;)
<barfoos>
i'm not thaat stupid :)
<dan2>
no, but its amazing how much you can do with such little syntax
<barfoos>
i'm pretty keen to see how the object orientet stuff is implemented. I've seen it in lisp and was quit disapointed, because it was such strange syntax.
<dan2>
OO is a fuckup really...
<barfoos>
ohhh
<dan2>
its been around for a LONG time and nobody fully understands it
<dan2>
but it solved a common class of problems associating data with its functions
<barfoos>
you mean polymorphism and dynamic binding?
<dan2>
barfoos: however, C++ while a failure as a language spec, offers great templating
<dan2>
barfoos: yes
<dan2>
templates were only made to help make more generic code
<dan2>
but people beat templates out in many unseen ways
<dan2>
template metaprogramming
<dan2>
its all about compile time optimization and offers a lot
<barfoos>
i've seen polymorphism (ad-hoc and parametric) in haskell, wish (as far as i know) does not do OO.
<dan2>
barfoos: no, classes = data + functions
<barfoos>
so they don't have it in haskell?
<dan2>
nope
<barfoos>
ah ok.
<dan2>
I think java could have been better if it had templates or something similar
<dan2>
generics are poorly named
<dan2>
generics == typesafe containers
<dan2>
which is a wonder why they didn't have it for so long
<barfoos>
you mean generics aren't as strong as templates?
<dan2>
no, they only add typesafety to containers
<dan2>
thats it
<dan2>
they have no other purpose
<dan2>
templates allowed for code genericity
<barfoos>
a thats a pitty. i thought with generics they would finally bring this functionality to java.
<dan2>
and java has it really fucked because its still one of hte only languages where map can't be implemented
<araujo>
dan2, why is that?
<dan2>
araujo: function pointers don't exist
<barfoos>
on the other hand. all the world that does do imperative programming isn't so much interessted in typesafety, so why did they actually introduce generics, when it only solves this problem?
<araujo>
so, functions aren't first class objects?
<dan2>
nope
<dan2>
well its clear why they did it
<dan2>
they knew if they brought templates in, it would really break the language as we know it
<barfoos>
thats a point
<araujo>
why?
<dan2>
templates add so much functionality that its so ridiculously hard to test the implementation
<dan2>
people have broken templates in so many ways
<dan2>
:)
<dan2>
it would make java an unstable language
<dan2>
thats not what sun wants
pango__ has joined #ocaml
ANON has quit [K-lined]
ANON has joined #ocaml
ANON has left #ocaml []
pango_ has quit [Read error: 110 (Connection timed out)]
Aradorn has joined #ocaml
Aradorn has quit [Remote closed the connection]
Submarine has joined #ocaml
vezenchio has joined #ocaml
_JusSx__ has quit ["leaving"]
Submarine has quit ["Leaving"]
Submarine has joined #ocaml
<barfoos>
in which module do I find read and write operations?
<barfoos>
i found it. it's in the Pervasives module
beta3 has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
barfoos has joined #ocaml
barfoos has quit [Client Quit]
barfoos has joined #ocaml
<barfoos>
hello again. It took me the whole day to produce 50 lines of code. and they don't work. Could I post these lines and someone would look at them?