flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml MOOC http://1149.fr/ocaml-mooc | OCaml 4.03.0 announced http://ocaml.org/releases/4.03.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
nicholasf has quit [Ping timeout: 250 seconds]
nicholasf has joined #ocaml
<flux> also seems it doesn't do multipart responses natively, so that also needs to be built on top of regular responses (required when requesting multiple ranges)
<flux> but maybe nothing does those requests :)
tautologico has joined #ocaml
picolino has quit [Remote host closed the connection]
picolino has joined #ocaml
nicholasf has quit [Remote host closed the connection]
unbalancedparen has joined #ocaml
tautologico has quit [Ping timeout: 244 seconds]
<rgrinberg> multipart support is available as a 3rd party - https://github.com/cryptosense/multipart-form-data
silver has quit [Quit: rakede]
<rgrinberg> which will supposedly be integrated to cohttp eventually.
<rgrinberg> I should help out with that...
<flux> I wrote this for doing partial transfers: https://github.com/eras/kodipush/blob/master/kodipush.ml
<flux> but it leaks file descriptors if the transfer isn't completed (ie. client disconnects)
<flux> is there something I'm missing? it seems other examples also just do the same thing, ie. use Lwt_strema.from and then close the file with Lwt_stream.on_termination
<flux> of course the way around that is to open the file for each block it reads, but..
<flux> the way to reproduce it is to put in the file name of a big media file to line 68, ocamlbuild --use-ocamlfind kodipush.native; ./kodipush.native and then mpv --no-cache http://localhost:8000/foo
<flux> after seeking around a bit lsof -p $(pidof kodipush.native) will show the media file is open multiple times
<flux> (I guess mplayer works as well, perhaps with -no-cache)
<flux> (also the files stay open even after the player exits)
<flux> rgrinberg, that multipart support seems to be for client side, not server side.. though client side is probably more complicated and more important anyway :)
<flux> maybe one way would be to hack Server.make ~conn_closed:(...) but is that really the way..
<flux> (probably by making a weak hash table from conns to my auxiliary data structure containing the list of active fds and closing them in the handler)
tautologico has joined #ocaml
Pieter_ has joined #ocaml
Pieter_ has quit [Client Quit]
seangrove has quit [Ping timeout: 276 seconds]
<mrvn> FDs should be a custom block with finalizer.
ollehar has quit [Ping timeout: 264 seconds]
tautologico has quit [Ping timeout: 258 seconds]
orbifx1 has quit [Ping timeout: 258 seconds]
<rgrinberg> flux: just to get it clear, are you looking to encode or decode multipart bodies?
darkf has joined #ocaml
kandu has joined #ocaml
GeoffSK has joined #ocaml
<GeoffSK> Hi - i am tying use Time.Span. I am using batteries, Do I need to use Std?
jmasseo has quit [Remote host closed the connection]
inr has quit [Ping timeout: 240 seconds]
cschneid has quit [Ping timeout: 250 seconds]
tautologico has joined #ocaml
cschneid has joined #ocaml
clog has quit [Ping timeout: 240 seconds]
GeoffSK has quit [Quit: Thanks, i am leaving]
tautologico has quit [Ping timeout: 276 seconds]
tmtwd has joined #ocaml
sh0t has quit [Remote host closed the connection]
nicholasf has joined #ocaml
slash^ has joined #ocaml
tmtwd has quit [Ping timeout: 260 seconds]
cheater has quit [Quit: leaving]
tmtwd has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
ollehar has joined #ocaml
jonasen has joined #ocaml
tmtwd has quit [Ping timeout: 258 seconds]
mattrepl has quit [Quit: mattrepl]
fluter has quit [Ping timeout: 258 seconds]
tautologico has joined #ocaml
rgrinberg has quit [Ping timeout: 276 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tane has joined #ocaml
xaimus has quit [Remote host closed the connection]
tmtwd has joined #ocaml
tautologico has quit [Ping timeout: 258 seconds]
nicholasf has quit [Ping timeout: 244 seconds]
nicholasf has joined #ocaml
MercurialAlchemi has joined #ocaml
adi___ has quit [Ping timeout: 258 seconds]
adi___ has joined #ocaml
A1977494 has joined #ocaml
pyon has quit [Ping timeout: 252 seconds]
<flux> mrvn, no. resource management in GC finalizer leads to suffering.
kushal has joined #ocaml
unbalancedparen has quit [Quit: WeeChat 1.5]
fluter has joined #ocaml
tmtwd has quit [Ping timeout: 244 seconds]
kushal has quit [Ping timeout: 265 seconds]
coolmenu has joined #ocaml
coolmenu has quit [Client Quit]
xaimus has joined #ocaml
ggole has joined #ocaml
Simn has joined #ocaml
nicholas_ has joined #ocaml
nicholasf has quit [Ping timeout: 240 seconds]
martinkl_ has joined #ocaml
shinnya has joined #ocaml
A19774941 has joined #ocaml
A1977494 has quit [Ping timeout: 252 seconds]
A19774941 has quit [Ping timeout: 260 seconds]
A1977494 has joined #ocaml
silver has joined #ocaml
jonasen has quit [Quit: Textual IRC Client: www.textualapp.com]
jonasen has joined #ocaml
orbifx1 has joined #ocaml
nicholasf has joined #ocaml
nicholas_ has quit [Ping timeout: 252 seconds]
martinkl_ has quit [Quit: Textual IRC Client: www.textualapp.com]
shinnya has quit [Ping timeout: 250 seconds]
govg has quit [Ping timeout: 258 seconds]
orbifx1 has quit [Ping timeout: 244 seconds]
inr has joined #ocaml
Submarine has quit [Ping timeout: 244 seconds]
tg has joined #ocaml
A1977494 has quit [Quit: Leaving.]
nicholas_ has joined #ocaml
Submarine has joined #ocaml
nicholasf has quit [Ping timeout: 260 seconds]
<tormen> flux: ... ah yes nice at least like this you would have one unified function that disperces :) ... thanks for your answer !!!
<tormen> btw. I started ocaml 2 month ago ;)
clog has joined #ocaml
rand__ has joined #ocaml
nicholas_ has quit [Ping timeout: 244 seconds]
orbifx1 has joined #ocaml
sdothum has joined #ocaml
diphuser has joined #ocaml
nicholasf has joined #ocaml
Nahra` has joined #ocaml
Nahra has quit [Remote host closed the connection]
Leonidas has quit [Ping timeout: 250 seconds]
Leonidas has joined #ocaml
hnrgrgr_ has joined #ocaml
hnrgrgr has quit [Read error: Connection reset by peer]
octachron has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 260 seconds]
tautologico has joined #ocaml
nicholasf has quit [Remote host closed the connection]
martintrojer has quit [Ping timeout: 240 seconds]
martintrojer has joined #ocaml
ollehar has quit [Quit: ollehar]
A1977494 has joined #ocaml
nicholasf has joined #ocaml
MercurialAlchemi has joined #ocaml
tautologico has quit [Ping timeout: 250 seconds]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
orbifx1 has quit [Ping timeout: 260 seconds]
orbifx has joined #ocaml
sh0t has joined #ocaml
nicholasf has quit [Read error: Connection reset by peer]
dhil has joined #ocaml
<gasche> b
MercurialAlchemi has joined #ocaml
sh0t has quit [Remote host closed the connection]
Simn has quit [Ping timeout: 260 seconds]
moneybug has joined #ocaml
tautologico has joined #ocaml
tane has quit [Ping timeout: 250 seconds]
govg has joined #ocaml
sh0t has joined #ocaml
<moneybug> Ocaml's threads don't seem to be truly parallel. So why does the documentation warn me about things not being thread-safe, such as here? http://caml.inria.fr/pub/docs/manual-ocaml/libref/Queue.html
<ggole> Queue.iter and .fold take function arguments. If those functions result in another thread running, and that thread mutates the Queue.t being walked over, boom.
octachron has quit [Ping timeout: 252 seconds]
tane has joined #ocaml
ontologiae has joined #ocaml
copy` has joined #ocaml
sh0t has quit [Remote host closed the connection]
<moneybug> Will the queue also fail if I mutate it during iteration without threads? What do threads add to the problem if there is a GIL and there are never 2 threads running at the same time?
<ggole> Threads can wait on I/O without holding the lock.
<ggole> Hmm, not sure about the first question.
<ggole> I don't think it will crash, but you might lose some elements or something.
<moneybug> In Java you can get a problem with references. E.g. you could have `let r = ref 0 in let i = incr ref in let t1 = Thread.create i () in let t2 = Thread.create i () in Thread.join t1; Thread.join t2; !r`
<moneybug> That could give you `1` or `2`. But sounds like ocaml always gives `2`.
<moneybug> That should be `let i () =`
<ggole> Yeah, there are no data races
<ggole> Threads will never execute at the same time
<ggole> (At least, so far.)
<moneybug> OK. Guess I won't worry too much about accidentally concurrently accessing the queue. As far as my tests show it's perfectly safe to have one thread push to a queue and another thread read off of it.
<ggole> OK, although I would not expect there to be a cast-iron guarantee of that continuing to work.
<ggole> I suppose you can introduce a mutex if multicore ocaml arrives and starts causing problems
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<moneybug> Where did you hear about multicore ocaml?
<ggole> It's been kicking around for years at this point
<ggole> And there was a presentation or two recently
<moneybug> Found a link here: https://ocaml.io/w/Multicore
AlexRussia has joined #ocaml
myst|fon has quit [Quit: Connection closed for inactivity]
tautologico has quit [Ping timeout: 260 seconds]
jmasseo has joined #ocaml
ollehar has joined #ocaml
tautologico has joined #ocaml
moneybug has quit [Ping timeout: 264 seconds]
orbifx1 has joined #ocaml
moneybug has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
orbifx1 has quit [Ping timeout: 264 seconds]
pyon has joined #ocaml
moneybug has left #ocaml ["Leaving"]
tautologico has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
MercurialAlchemi has joined #ocaml
octachron has joined #ocaml
rgrinberg has quit [Quit: WeeChat 1.5]
rgrinberg has joined #ocaml
diphuser has quit [Ping timeout: 260 seconds]
shinnya has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
ontologiae has joined #ocaml
A1977494 has quit [Ping timeout: 240 seconds]
A1977494 has joined #ocaml
Algebr`` has joined #ocaml
ontologiae has quit [Ping timeout: 258 seconds]
ollehar has quit [Quit: ollehar]
jmiven has quit [Ping timeout: 240 seconds]
jmiven has joined #ocaml
tautologico has joined #ocaml
Simn has joined #ocaml
malc_ has joined #ocaml
tautologico has quit [Ping timeout: 244 seconds]
<gasche> ggole: adding mutexes when all hell start breaking loose is a rather bad choice in my opinion, concurrent Thread-using code should already use mutexes to protect global shared resources
sh0t has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<malc_> gasche: what would be, in your opinion, best way to compile objective-c that has to interface ocaml? .m is not .c and as such ocaml (the driver) refuses to do anything.
sdothum has joined #ocaml
loocash has joined #ocaml
Submarine has quit [Ping timeout: 258 seconds]
unbalancedparen has joined #ocaml
AlexRussia has quit [Ping timeout: 258 seconds]
Submarine has joined #ocaml
<gasche> malc_: I don't know anything about objective-C compilation, is it supposed to work as-is when passed to a C compiler?
<malc_> gasche: yep
<gasche> just Clang, or does it also work with gcc?
<malc_> gasche: the main and only issue is suffix .m vs .c
<gasche> (or is there still a preprocessing phase that turns it into plain C?)
<malc_> gasche: there's no preprocessing
<malc_> gasche: both(gcc/clang) have a functioning obj-c backends
<malc_> gasche: in fact renaming file to .c and passing -x objective-c works
<malc_> but, uhm...
<gasche> I know of no easy option when invoking "ocamlc" directly
<gasche> we have an -intf-suffix to change the ".mli" convention, but I know of no such thing for .ml or .c; this could be a reasonable feature request
<gasche> if you are writing a build system rule, renaming is fine
<gasche> but it should also be easy to invoke a C compiler directly instead of the ocamlc driver, which is just a convenience
<malc_> gasche: not really, no. it can pass -m32/64 it can pass whatever is needed
<malc_> knowledge that is not made pubic
<malc_> hence my predicament
<gasche> hm
<gasche> one thing is that you can pass .o/.a files to have the driver do the linking after copmilatoin
<gasche> so you don't need to reinvent the linking part
diphuser has joined #ocaml
<malc_> having -as-c would work, having some variation on ocaml[c|opt] -where would work to
<gasche> now the question is "how to emulate the compilation behavior of ocamlc on ocamlc?"
<gasche> indeed having a kind of "ocamlc -cflags" would work as well
<malc_> s;to;too
<gasche> aha!
<gasche> ocamlc -config | grep compiler
<gasche> so malc_ the C compilation function is https://github.com/ocaml/ocaml/blob/trunk/utils/ccomp.ml#L67-L102
<gasche> ( Ccomp.compile_file )
<malc_> gasche: merci beaucoup for -compiler!
<gasche> it seems to only use whatever configured decided as "the C compiler", pass (-I <standard library path>), and pass user-provided -cc* arguments
loocash has quit [Quit: Leaving]
<malc_> -fno-strict-aliasing ... sigh
<malc_> -fwrapv ouch
<malc_> oh well
<malc_> weird that PIC is used for byte but not native code...
<justin_smith> is that because byte code is loaded into toplevels, but native code is statically compiled with the binary?
madroach has quit [Ping timeout: 244 seconds]
rgrinberg has quit [Ping timeout: 244 seconds]
<malc_> justin_smith: `git log -p --grep=PIC` inside ocaml checkout can give some hints
<Algebr``> malc_: I've done a lot of objc with ocaml
<malc_> gasche: btw. ocamlc -config | grep bytecomp_c_co | awk -F': ' '{print $2}' yields gcc -std=gnu99 -O2 -fno-strict-aliasing -fwrapv -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC, sad that "-I $(ocamlc -where)/caml" is absent...
copy` has quit [Quit: Connection closed for inactivity]
<malc_> Algebr``: oh. compiled it with just gcc/clang and hoped for the best?
sh0t has quit [Remote host closed the connection]
<Algebr``> no, everything worked well and correctly.
<Algebr``> even better to compile as objc++
<malc_> Algebr``: i have no doubt that it worked, what i doubt is that you have proof that it will continue to
<Algebr``> ok
tautologico has joined #ocaml
<malc_> Algebr``: do you still have/run OSX?
<Algebr``> yes
<malc_> or macOS or whatever nomdejour is
<malc_> Algebr``: mind trying to build/run something?
orbifx1 has joined #ocaml
<Algebr``> sure
<Algebr``> you're not passing headers correctly
<Algebr``> cc -c -o main_osx.o main_osx.m main_osx.m:10:10: fatal error: 'caml/mlvalues.h' file not found #include <caml/mlvalues.h> ^ 1 error generated.
<malc_> Algebr``: I'm innocent, notice the nojb part of the repo uri
<Algebr``> i see
<Algebr``> ah, I could fix it later...
<malc_> (FWIW it seems to build here on two different osx installations).. hmmm
rgrinberg has joined #ocaml
<Algebr``> the makefile has some things that could be easy wins
<malc_> Algebr``: such as?
<Algebr``> doing foo := $(shell ) instead of plain =
<Algebr``> := will do it once
<Algebr``> = will do it each time foo is used...pretty sure this is the case.
<malc_> Algebr``: yeah sure
<malc_> only those are used once, so not much of a win (currently)
tautologico has quit [Ping timeout: 258 seconds]
dhil has quit [Ping timeout: 250 seconds]
mattrepl has joined #ocaml
orbifx1 has quit [Ping timeout: 244 seconds]
unbalancedparen has quit [Ping timeout: 258 seconds]
<gasche> malc_, justin_smith: -fPIC gives a slight degradation in code quality, so it is not the default for the native compiler
diphuser has quit [Remote host closed the connection]
diphuser has joined #ocaml
<gasche> (I don't remember those low-level details but iirc. it forces to turn some known-offset jumps into slightly slower jumps)
unbalancedparen has joined #ocaml
<malc_> gasche: that's mostly a 32bit thing, then again...
<gasche> also, I believe that the compiler options are the one used to build the OCaml runtime itself
<gasche> the reason it disables some of these optimizations is that the runtimes relies on behaviors that would be undefined without these flags
<malc_> gasche: FILE_OFFSET_BITS changes quite a few things
<gasche> I'm not sure why these optimizations would be passed to user code compiled through ocamlc, maybe the idea is that ocaml-FFI code will use typically the same kind of patterns
<gasche> (eg. assumptions on the low bits of adresses cast as integers)
<malc_> and fwrapv and stirct aliasing options can make quite a difference in the preprocessing hackery around CAMLvalue etc
<Algebr``> okay this is super freaking weird to me. I have a type error because an unlabeled variable name happens to have the same name as a object type
<malc_> gasche: justin_smith's assertion about loading stuff into top-level seems correct
<Algebr``> the function is: fun ?(key="") this event ->
<Algebr``> and there happens to also be a this object type defined
<gasche> reproducible code?
<Algebr``> yes, can commit and share
<gasche> malc_: indeed, code for toplevel needs to be -fPIC iirc.
<gasche> but note that there is also a native toplevel
<gasche> and you can get a native build of OCaml with -fPIC; the question is more of why this choice of default
<Algebr``> gasche: were you saying reproducible to me?
<gasche> I mean that it's hard to help you / test / be convinced without a code example
<gasche> (and if that really is the problem you say then a two-line snippet should suffice)
<gasche> malc_: what is FILE_OFFSETS_BITS? something about the size of some C type?
<Algebr``> gasche: will try to condense to essense of problem
<malc_> gasche: info libc i feaure test macros describes FILE_OFFSET_BITS in some detail
<justin_smith> malc_: it was more of a guess rather than assertion, to be fair
kakadu has joined #ocaml
<malc_> justin_smith: it is certainly a valid one from where i stand (esp. on x86/32 and SysV ABI)
<malc_> gasche: or less full explanation here - http://linux.die.net/man/7/feature_test_macros
<gasche> ok, thanks
sh0t has joined #ocaml
<Algebr``> gasche: ahh, it was a case of forgetting to use |> and the types still working
<Algebr``> mostly
sh0t has quit [Ping timeout: 264 seconds]
A1977494 has quit [Remote host closed the connection]
martinium has joined #ocaml
<Algebr``> oh lol, infix functions can also be labeled
<Algebr``> let ( >>> ) ~f ~g = () let result = ( >>> ) ~f:123 ~g:45
<Algebr``>
<Drup> Algebr``: and you can have more or less than 2 arguments, and optional arguments
<Drup> it's remarquably useless, though
<Algebr``> I'm trying to make it work with optionals too but can't find the right combination
<Drup> (well, actually, more than 2 arguments can be useful, but it's very specific)
<Algebr``> using optionals makes it lose infix when only two args
<Drup> that's why it's useless :)
<Algebr``> damnit
<Algebr``> oh well
dhil has joined #ocaml
<malc_> Algebr``: no luck building the thing?
<Algebr``> hmm, haven't tried doing other things
slash^ has quit [Read error: Connection reset by peer]
darkf has quit [Quit: Leaving]
<malc_> Algebr``: ok
struk|desk has joined #ocaml
struk|desk2 has quit [Ping timeout: 240 seconds]
moneybug has joined #ocaml
jackweirdy has joined #ocaml
strykerkkd has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
moneybug has quit [Quit: Leaving]
orbifx has quit [Ping timeout: 264 seconds]
rgrinberg has quit [Ping timeout: 264 seconds]
MercurialAlchemi has joined #ocaml
octachron has quit [Quit: Leaving]
jlouis has quit [Ping timeout: 258 seconds]
jlouis has joined #ocaml
jackweirdy has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
martinium has quit [Ping timeout: 258 seconds]
martinium has joined #ocaml
Submarine has quit [Ping timeout: 265 seconds]
unbalancedparen has quit [Quit: WeeChat 1.5]
rgrinberg has joined #ocaml
jackweirdy has joined #ocaml
tane has quit [Quit: Leaving]
Simn has quit [Quit: Leaving]
jackweirdy has quit [Quit: Textual IRC Client: www.textualapp.com]
ggole has quit [Ping timeout: 244 seconds]
unbalancedparen has joined #ocaml
diphuser has quit [Ping timeout: 260 seconds]
wolfcore has quit [Ping timeout: 258 seconds]
tautologico has joined #ocaml
wolfcore has joined #ocaml
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
tautologico has quit [Ping timeout: 244 seconds]
silver has quit [Quit: rakede]
wolfcore has quit [Ping timeout: 244 seconds]
wolfcore has joined #ocaml
copy` has joined #ocaml
rand__ has quit [Quit: leaving]
MercurialAlchemi has quit [Ping timeout: 252 seconds]
kakadu has quit [Remote host closed the connection]
unbalancedparen has quit [Quit: WeeChat 1.5]
reynir is now known as turgenevskaya
turgenevskaya is now known as reynir
<Algebr``> gasche: who do I contact about the ocaml mailing list again?
tautologico has joined #ocaml
rlr has left #ocaml [#ocaml]
cat5e has quit [Read error: Connection reset by peer]
Soni has joined #ocaml
Soni is now known as cat5e
Algebr`` has quit [Ping timeout: 250 seconds]
strykerkkd has quit [Remote host closed the connection]