gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 256 seconds]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
ulfdoz_ is now known as ulfdoz
mjonsson has joined #ocaml
<mjonsson> Does ocamlbuild not understand local opens? (i.e. let open MyModule in ... / MyModule.(...))
pngl has quit [Ping timeout: 246 seconds]
<_habnabit> mjonsson, ocamlbuild doesn't care about things like that
lggr has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
<mjonsson> Hm. Okay, I will describe my concrete problem then
<mjonsson> I have functions in module A (A.ml) that I use in module B (B.ml). It worked well when I was using direct A.function references but not with local opens. (I could be misdiagnosing the problem still.)
<mjonsson> so actually, it is not ocamlbuild that is complaining, it is ocamlc
<mjonsson> ocamlbuild MusicTest.native
<mjonsson> /usr/bin/ocamldep.opt -modules MusicTest.ml > MusicTest.ml.depends
<mjonsson> /usr/bin/ocamlc.opt -c -o MusicTest.cmo MusicTest.ml
<mjonsson> + /usr/bin/ocamlc.opt -c -o MusicTest.cmo MusicTest.ml
<mjonsson> File "MusicTest.ml", line 3, characters 4-13:
<mjonsson> Error: Unbound value polyphony
<mjonsson> polyphony is defined in the Music module and I'm refering to it using Music.(.... polyphony...)
lggr has joined #ocaml
<mjonsson> ...
<mjonsson> problem solved by nuking the _build directory
<mjonsson> somehow the build system got confused and didn't rebuild properly
lggr has quit [Ping timeout: 252 seconds]
caligula__ has quit [Ping timeout: 240 seconds]
caligula__ has joined #ocaml
lggr has joined #ocaml
<wmeyer> hongboz: Camlp4 formatted print code generator welcome
bbrittain has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
madroach has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
<hongboz> wmeyer: I am also making revised syntax more like original syntax(if not ambiguity introduced), this is really trivial, but important IMHO
lggr has joined #ocaml
<wmeyer> hongboz: is it included on your bitbucket branch?
<hongboz> yes
<wmeyer> hongboz: remember about point fixes :-)
<wmeyer> i will check that later, still need to look at Fan
<hongboz> wmeyer: sure, any non-trivial change I will do a fix point check
<wmeyer> hongboz: ok :-)
lggr has quit [Ping timeout: 248 seconds]
<pippijn> wmeyer: first of all, I like Qt
<pippijn> wmeyer: secondly, I want to learn about ocaml/C++ bindings
<pippijn> wmeyer: and the reason I'm doing it at all is that I want to make a gui for my C frontend
<wmeyer> pippijn: not like I am offending
<wmeyer> (i just personally don't like Qt)
<wmeyer> pippijn: yes, sounds reasonable
<hongboz> mjonsson: the output by ocamldep is un-reliable
<hongboz> especially when you use functors heavily
hongboz has quit [Remote host closed the connection]
lggr has joined #ocaml
avsm has joined #ocaml
<pippijn> wmeyer: I want to generate the entire (or as much as possible of the) binding
<wmeyer> avsm: we have 80 people tomorrow for makespace
<wmeyer> i think it's a bit extreme
<avsm> wmeyer: nice! say hi to laura for me. i'll be over there in november
<wmeyer> pippijn: sure, sounds like a fun project
<wmeyer> avsm: will do, btw: i met dave chisnal today
<wmeyer> didn't know he works in the lab
<avsm> yeah, on our CPU-capability project...
<wmeyer> avsm: but he is not involved in ocaml directly :) he does the smalltalk really
<avsm> next step: OCaml/LLVM :-)
<pippijn> can LLVM support ocaml's exceptions?
<wmeyer> pippijn: what i heard today should
<pippijn> because ocaml exceptions are super fast compared to C++ ones (supported by LLVM)
<wmeyer> (that was one of the things we discussed on the llvm meetup)
<wmeyer> pippijn: I don't think the llvm backend can be ever fast as the one we have, even given the optimisations it performs
<pippijn> hmm
<wmeyer> since ocaml generates a LOT of functions
<wmeyer> and you know, llvm does not do interprocedural optimisations
lggr has quit [Ping timeout: 252 seconds]
<pippijn> but llvm does inlining
<wmeyer> (for the same reason i will not suport in the low level RTL functions at all)
<wmeyer> pippijn: sure, basic one, compared to haskell
<wmeyer> inlining helps
<wmeyer> but does fix the deficiency that the optimisations are performed on a function level
<wmeyer> (yes, i got your messages, aggresively inline to turn the functions into basic blocks and then to the classical ssa passes)
<pippijn> yes
<wmeyer> well it improves situation, but ocaml has higher order functions, that needs to be propagated somewhat as values
<wmeyer> i really think we need a messiah :)
<pippijn> by the way, ocaml really doesn't like this pattern: let f = function A a -> (function A a | B b | C c) | B b -> (function A a | ...
<pippijn> I thought it was a good idea, but in fact this generates much better code: let f a b = match a, b with A a, A a -> ... | A a, B b -> ...
<bbrittain> so I'm trying to figure out a problem that someone presented to me. I'm actually a little worried that it isn't possible... I'm not too familiar with oCaml, so some help would be appreciated.
<bbrittain> the tree was supposed to represte a complete tree
<pippijn> wmeyer: right.. higher order functions are dynamically allocated structures with function pointers in them, I suppose
lggr has joined #ocaml
<bbrittain> I was attempting to write a map function for it, but does that tree type even represent a complete tree properly?
<wmeyer> bbrittain: you have polymorphic recursion, start with some simplier definition; i suppose it's taken from try ocaml :)
<pippijn> a generic (mostly C-targetted) framework like LLVM doesn't like optimising those at all
<wmeyer> pippijn: yes. I'm implying LLVM currently does not support functional languages. Although GHC says it's brilliant and the benchmarks say so. Perhaps that was hard work and patches up stream.
<pippijn> wmeyer: I think a specialised ocaml compiler can make a lot more assumptions on how things work than something like LLVM
<wmeyer> pippijn: yes. The thing is that LLVM hits the sweet spot for C and C++ :)
<pippijn> yes
<pippijn> for now :)
<wmeyer> pippijn: you know, single IR must be ssa. Functions must be also if it's single IR.
<wmeyer> pippijn: not with current IR
<wmeyer> pippijn: the only way to carry information across passes is to use meta data, and i don't think it's viable as of 2012
<wmeyer> i know it's C++ so constructing another IL is pain
<wmeyer> but it would cut just better if LLVM was lower level than what is now
<wmeyer> than clang would have another IR
<wmeyer> and every language implementor would need to have IR in between LLVM and frontend
<wmeyer> (at least that's what i would do)
<pippijn> of course, many languages could share one IR
lggr has quit [Ping timeout: 256 seconds]
<pippijn> C and C++ could share one
<pippijn> java could share the C/C++ one, too
<pippijn> C#...
<wmeyer> pippijn: so on my github project, the goal is to collect these
<wmeyer> but the lowest one is RTL
<pippijn> wmeyer: collect what?
<wmeyer> IRs
<pippijn> ah
<pippijn> RTL in gcc?
<wmeyer> so the backend of a language would look like this
<pippijn> register t..something language
<pippijn> transfer or something
<wmeyer> <choose the right IR> -> RTL -> SSA RTL -> Mach RTL -> Machine
lggr has joined #ocaml
<wmeyer> that's right, we would not need SSA at all in that case :)
<wmeyer> ssa is cool for optimisations
<wmeyer> and that's it
<pippijn> gcc does a lot of optimisations on RTL, right?
<wmeyer> for code generation is not cool
<pippijn> ah, for code generation it's the worst :)
<wmeyer> yes it does, mainly peephole; but remember you told me about BURG
<pippijn> BURS is cool
<wmeyer> so SSA RTL will be then translated into TREE RTL and then selection will happen
<wmeyer> after that reg alloc
<pippijn> it's ocaml-style pattern matching with weights
<wmeyer> and flattening again
<wmeyer> yep, that's what we will use
<wmeyer> but hold on
<pippijn> we?
<pippijn> who are you?
<pippijn> (plural you)
<pippijn> and what exactly are you working on?
<wmeyer> sorry; meant community
<pippijn> ah
<wmeyer> i am working on the compiler framework
<wmeyer> in OCaml
<wmeyer> that's why I am keen on your frontend
<wmeyer> avsm: I just noticed somebody posted paper about ADL - Architecture Description Language
<wmeyer> strangely that was the name i was thinking before
<wmeyer> (they generate or want to generate LLVM backend boilerplate out of the single spec)
<pippijn> ADL
<avsm> that's kind of a general term. there was something released about 8 years ago called that too
<wmeyer> but for some reasons i remain calm ;-)
<hcarty> wmeyer: Regarding printing + camlp4 - Batteries's pa_string syntax extension has some impressive printing capabilities.
<pippijn> yes, sounds very generic
<wmeyer> ah looks cool
lggr has quit [Ping timeout: 248 seconds]
<wmeyer> but its old
<wmeyer> somewhat i have ./archc.native too
<hcarty> wmeyer: And as hongboz mentioned, xstrp4 can do some nice things. I've done some hacking on xstrp4 to make it a bit more general and extensible.
<wmeyer> hcarty: cool :) You know, the format strings can be parsed most of the time at compile time. So we either have static spec, which might be not a string but something more composable, or just use combinators for smaller amounts of code
<hcarty> wmeyer: xstrp4's internals do something similar to what thelema suggested, although perhaps not as effcient
<wmeyer> (in fact strings are barely composable; therefore the code produced is also difficult to compose)
<wmeyer> hcarty: neeed to look at it
<pippijn> funny.. yesterday it didn't segfault
<hcarty> wmeyer: My hacks on xstrp4 allow for things like <<Interpolate here: ${foo_value, custom_foo_printer}>>
<hcarty> or <:sql<select foo from table where date = ${date, d}>>
<wmeyer> avsm: yes, i didn't know about this. Thanks for the link. Definitely it's a nice source of ideas.
<hcarty> wmeyer: Unfortunately it's built on camlp4 which seems to constantly rise and fall in popularity and soundness of future
<wmeyer> hcarty: Yes, but in general it's the right thing to do
<hcarty> thelema: If anything were done with ocaml-pretty + Batteries I was thinking it would be instead of something built on format, not in addition to.
<wmeyer> i am sure Hongbo will not make Camlp4 die
lggr has joined #ocaml
<hcarty> That's my hope
<pippijn> is camlp4 good?
<wmeyer> hcarty: I will look into xstrp4 thanks - I didn't even know about it :-)
<pippijn> I just tried to make something once but gave up due to a lack of motivation to learn about it
<wmeyer> pippijn: it depends, what you want. Generally I think it's pretty cool. Nevertheless it could be much better.
<pippijn> my C frontend is supposed to turn into a camlp4 for C, by the way
<pippijn> that's one of its goals
<hcarty> wmeyer: It's pretty nifty. My hacks are here - http://0ok.org/cgit/cgit.cgi/xstrp4/
<wmeyer> pippijn: there is a big hype about it
<pippijn> another goal is region based memory management
<wmeyer> pippijn: yes, i suppose to do this :-)
<pippijn> I want program transformations
<hcarty> wmeyer: Original is here - http://projects.camlcity.org/projects/xstrp4.html
<pippijn> in C
<wmeyer> pippijn: it's on my todo.
<wmeyer> yes
<wmeyer> pippijn: once you have quotations, it's easy
<pippijn> yes
<wmeyer> you can have quotes at the left side of match
<wmeyer> + gives you enormous power to just generate nice C
<pippijn> yeah :)
<hcarty> pippijn: For OCaml + camlp4 + C, ciml is an interesting project. Not what you're talking about I don't think, but a pretty cool use of camlp4.
<hcarty> pippijn: http://chadok.info/ciml/
<pippijn> haha
<pippijn> that's cool
<wmeyer> hcarty: ciml is limited ;-) (from what I see)
<wmeyer> hcarty: but you know this :-) I think pippijn is also amused
<wmeyer> hcarty: pippijn have full C ast
<wmeyer> parsing that inside quotations would do the job :)
<hcarty> wmeyer: Very limited! I've never taken the time to use it beyond compiling the included tests. But it's still interesting from a quick-and-dirty bindings perspective.
<pippijn> pippijn is lazy about implementing type checking :\
<hcarty> wmeyer: ciml won't quite compete with that :-)
<pippijn> seeking around in the C standard is tiring
<pippijn> I'm happy I'm not doing C++, though
* wmeyer attempted to parse the C standard once (and never wanted to do this again)
<wmeyer> oh C++ is even more horrific
<wmeyer> (much more horrific)
<pippijn> it's completely horrific
lggr has quit [Ping timeout: 244 seconds]
<hcarty> pippijn: A tool combining the features of camlidl + saffire would be quite a thing to have (binding code generation + type checking of bindings)
<wmeyer> hcarty: it looks like a dirty hack :)
<wmeyer> hcarty: xstrp4 examples look nice, somewhat reminds me perl
lggr has joined #ocaml
<wmeyer> hcarty: Great idea!
<wmeyer> i suppose once pippijn have camlp4 extension sounds like a easy cake
<wmeyer> i need to go to bed
<wmeyer> tomorrow i have a lot of paperwork to do
<wmeyer> which i've been gently avoiding for 2 weeks
<pippijn> good night
<wmeyer> it's 3:30 :P
<wmeyer> pippijn: i suppose you will have lunch soon
<pippijn> yes
<pippijn> it's 10:33
* wmeyer been to china quite few times
<pippijn> :)
<pippijn> by the way
<hcarty> It's 10:34 here, but perhaps a different 10:34
<pippijn> this is what I like about C++
<wmeyer> hcarty: 10:34 PM :)
<wmeyer> so i am in the middle, the worst case
<wmeyer> 3:30 AM is not a sane part of the ?day?night?
lggr has quit [Ping timeout: 256 seconds]
<pippijn> and this is what I dislike: http://paste.xinu.at/A00U/
<pippijn> and it's the same thing :)
<wmeyer> looks like C++0X (first one) and the second one like TR2 :)
<wmeyer> now tell them to use lambdas!
<pippijn> both are C++0x
<pippijn> it's cool
<pippijn> statically checked match of ocaml variants
<wmeyer> Last time when I used heavy C++ was about 6 years ago
<wmeyer> the world has changed since then
<wmeyer> sure
<wmeyer> template specialisation
<wmeyer> now
<pippijn> variadic templates
<wmeyer> yes, its powerful, but CLang with debug symbols goes mad to 6GB during linking
<pippijn> ah yes
<pippijn> that's true
lggr has joined #ocaml
<wmeyer> pippijn: nice snippets! but I gtg... and face tomorrow, paper work day....
<pippijn> good night then :)
* wmeyer says good bye to pippijn & hcarty :-)
<pippijn> can I instruct oasis to build with ocamlbuild -j 8?
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
<pippijn> okay, debugging callbacks sucks
<pippijn> passing 1 argument instead of the expected 0...
<pippijn> gives you exactly no stack trace and no useful valgrind output
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
bbrittain has quit [Remote host closed the connection]
Yoric has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
osa1 has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 265 seconds]
gnuvince has joined #ocaml
mjonsson has quit [Quit: Leaving]
lggr has joined #ocaml
kba has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
Yoric has quit [Ping timeout: 256 seconds]
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
avsm has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
cdidd has quit [Ping timeout: 265 seconds]
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
ankit9 has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
ankit9 has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
othiym23 has quit [Ping timeout: 260 seconds]
dgfitch_ has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
dgfitch has joined #ocaml
othiym23 has joined #ocaml
ankit9 has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
pango is now known as pangoafk
lggr has joined #ocaml
Yoric has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
ankit9 has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
ontologiae has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
ankit9 has joined #ocaml
lggr has joined #ocaml
Cyanure has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
ontologiae has quit [Ping timeout: 265 seconds]
ftrvxmtrx has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 264 seconds]
osa1 has quit [Quit: Konversation terminated!]
djcoin has joined #ocaml
ankit9 has quit [Remote host closed the connection]
lggr has joined #ocaml
sepp2k has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
eikke has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
Kakadu has joined #ocaml
lggr has joined #ocaml
mika1 has joined #ocaml
cago has joined #ocaml
lggr has quit [Ping timeout: 265 seconds]
ivan\ has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
err404 has joined #ocaml
ankit9 has joined #ocaml
ivan\ has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
thomasga has joined #ocaml
ontologiae has joined #ocaml
lggr has joined #ocaml
ftrvxmtrx has joined #ocaml
lggr has quit [Ping timeout: 265 seconds]
Yoric has quit [Ping timeout: 264 seconds]
lggr has joined #ocaml
chambart has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
pngl has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
Kakadu has quit [Quit: Konversation terminated!]
lggr has joined #ocaml
madroach has joined #ocaml
tufisi has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
tufisi has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
Yoric has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
tchell has quit [Ping timeout: 245 seconds]
tchell has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
Oejet has joined #ocaml
thomasga1 has joined #ocaml
thomasga has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
tufisi has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
eikke has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
beckerb has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
eikke has joined #ocaml
lggr has joined #ocaml
_andre has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
chambart has quit [Read error: Operation timed out]
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 265 seconds]
madroach has quit [Quit: leaving]
madroach has joined #ocaml
lggr has joined #ocaml
Oejet has quit [Read error: Connection reset by peer]
Oejet has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
thomasga1 is now known as thomasga
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
ontologiae has joined #ocaml
chambart has joined #ocaml
Oejet has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
<hcarty> thelema: The pp-patch/pull request goes into BatIO.Incubator. That seems like a safer option until a final layout and implementation is decided on.
<ansx_> I don't understand how to use records in OCaml :(
<ansx_> for instance how to read values in the record returned by Gc.stat
<fx_> ansx_, let x = Gc.stat () in x.Gc.minor_words
<fx_> record fields are qualified with module name
<ansx_> wow.... didn't know that :)
lggr has quit [Ping timeout: 248 seconds]
<ansx_> I also don't quite understand why you sometimes need to use ; but sometimes ;;
<ansx_> also I don't really understand how is your line of code working
<flux> ansx_, a file consists of blocks. each block is either a sequence of top-level statements or an expression. each block is separated by ;;.
<ansx_> yeah but let number = 3
<ansx_> and let number = 3;;
<ansx_> is the same at the top level isn't it?
<flux> examples of top-level statements: type i = int let a = 42
<flux> yes
<flux> basically top-level evaluates blocks only
<ansx_> looks like some inconsistency to me
<flux> you might get confused because of the two forms or let
<flux> let a = 42 <- top-level statement
<flux> let a = 42 in b <- an expression
<flux> (OF let)
<ansx_> well, even without the "in" I'm confused
<flux> you can write let a = 42 let b = 55 let baz = a + b all day long to your toplevel
<ansx_> why would "let a = 42;;" and "let a = 42" do the same thing?!
<flux> but you need to type ;; to make it evaluate it
<ansx_> ok... but if I don't use ;;, what would be the value of a ?
<flux> well, you the toplevel doesn't evaluate it before you use ;;
<ansx_> I don't really see a difference between the 2 cases when there is nothing to evaluate
<flux> for example let a = print_string "hello" by itself doesn't output anything
<flux> if you add a new string let b = print_string "world" it still doesn't output anything
<flux> but when you type ;;, it outputs helloworld
<flux> in fact, if you make a mistake in that block, say let type = fun, it will execute nothing
<flux> it is as if you had never written the previous statements
<ansx_> now I'm doing some testing with this
<flux> so the first two ;;'s are not required there
<flux> because without ;;'s they form a sequence of three top-level statements
<flux> next follows an expression, and there must be a ;; between that and the last statement
<flux> because there cannot be statements and expressions without a separating ;;
<flux> what you can do, though, is write programs without ;; at all
<flux> my making those expressions statements
<flux> for example by adding "let _ =" before the "try"
<ansx_> well the piece of code I have does "work"
<ansx_> but what I'm trying to do is evaluate how much memory does ocaml consumes for mutual recursive calls
<ansx_> so I'd like to move the heavy_memory_object insode the recursive odd/even functions
<ansx_> but copying the line right after the function declaration doesn't seem possible..
<ansx_> like right after the let rec odd n =
lggr has joined #ocaml
<flux> ok
<flux> so you cannot have statements inside expressions
<flux> so basically what happens you add 'in' after your top-level statement before putting it inside a function
<ansx_> blocks, statements, and expressions now?
<flux> yes :)
<ansx_> god damnit is there anything normal in ocaml :(
<flux> let sum4 a b c d = let sum a b = a + b in sum (sum a b) (sum c d)
<flux> "let sum a b = a + b" would be a statement
<flux> "let sum a b = a + b in xxx" is an expression
<flux> "let sum4 a b c d = let sum a b = a + b in sum (sum a b) (sum c d)" is a statement (or "top-level statement")
<flux> "let sum4 a b c d = let sum a b = a + b in sum (sum a b) (sum c d) in xxx" would be an expression
<ansx_> well, ok...
<ansx_> not sure I get it yet
<flux> but I need to leave now
<flux> happy hacking, I hope you'll get it :)
<ansx_> the "in" seems like a scope limitation
<fx_> exactly
<ansx_> not sure why it changes stuff from statement to expression
lggr has quit [Ping timeout: 260 seconds]
<mehdid> "let a = … " adds "a" in the environment but "let a = … in b" returns "b", an expression.
<mehdid> does that help?
<ansx_> well yeah... but I still don't understand how I'm supposed to do what I'm looking for
<ansx_> I have the "let rec" construct, and I want to create heavy objects during the execution of said construct
<ansx_> let heavy_memory_object = Array.make_matrix 10 1000000 0;
<ansx_> so why can't I just use this line right after declaration?
<fx_> "use this line after declaration" <- doesn't make any sense
<ansx_> well
<ansx_> let rec odd n =
<ansx_> let heavy_memory_object = Array.make_matrix 10 1000000 0;
<ansx_> so I on each call to odd I'll allocate a matrix object
<fx_> yes
<ansx_> well how to do that?
<ansx_> I tried pretty much everything I know to have this allocation inside the "odd" declaration, but I can't get it to even compile
lggr has joined #ocaml
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 255 seconds]
<ansx_> well I can get it to work in "in"
Yoric has joined #ocaml
<ansx_> but now I don't understand the "let x = Gc.stat () in x.Gc.minor_words"
lggr has quit [Ping timeout: 246 seconds]
<ansx_> why the hell would I need to use x in x.Gc.minor_words :(
<ansx_> let minor_words = Gc.stat() in minor_words.Gc.minor_words
<ansx_> the last statement looks like a joke
<fx_> let x x = x,x
fraggle_laptop has quit [Read error: Connection reset by peer]
<ansx_> hm?
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
ankit9 has quit [Quit: Leaving]
hongboz has joined #ocaml
<hcarty> ansx_: What are you trying to do?
lggr has joined #ocaml
<hcarty> ansx_: More precisely, what are you trying to do that you are unable to do and/or don't understand?
<hcarty> ansx_: Depending on where you are coming from OCaml (and its language relatives) take a bit of getting used to.
cdidd has joined #ocaml
<ansx_> well actually I know a lot of programming langages
<ansx_> including a few functional ones
<ansx_> but ocaml... is probably the strangest thing I came across yet
lggr has quit [Ping timeout: 260 seconds]
<ansx_> that's what I have now
<ansx_> and I don't understand compilation issue with "int" instead of float
<ansx_> well float instead of int actually
<fx_> # (+);;
<fx_> - : int -> int -> int = <fun>
<fx_> and the indentation is wrong
<hcarty> ansx_: Values are not automatically converted from one type to another for one
<fx_> i.e. doesn't match control flow
<ansx_> hm ok so do I have some float equivalent for + ?
<hcarty> ansx_: You need to replace the + with +.
<ansx_> +. ok
<ansx_> just checked the doc :p
<hcarty> ansx_: And -. and *. and /. for floating point infix operators
<ansx_> having different operators for the same operation is strange imho...
<hcarty> ansx_: They are there because an int is not the same as a float
<hcarty> ansx_: OCaml doesn't have operator overloading
<ansx_> yeah I understand that, but ocaml is pretty much the only langage I know where you can't use the same annotation for both
<ansx_> yeah I clearly see that...
lggr has joined #ocaml
<smondet> they are really not the same operation (different behavior regarding overflow, division by zero, etc)
<hcarty> OCaml is also the only language I know of where 'let add a b = a + b' will do the right thing
<hcarty> Without annotation
<hcarty> ansx_: It's definitely surprising at first, but it's useful
<ansx_> so ok now this aprt compiles but it seems I can't end my "if" block with the print_endline because it makes the function return unit
<ansx_> while it should return only int
<ansx_> hmmmmmm bool, not int
<hcarty> ansx_: 'if' without 'else' implicitly adds an 'else' branch returning unit
<ansx_> . . .
<ansx_> is there any "construct" that would help not returning unit?
<ansx_> I mean... not add the "default" else
<djcoin> ?
<ansx_> because obviously in my case I don't have anything clever to do in the "else" branch
<ansx_> well print_endline is returning unit aswell, so I would only be moving the problem...
<hcarty> ansx_: Wrap the if n mod 100 = 0 ... part in let () = ... in
<djcoin> why don't you add as the last line the variable you want to return ?
<hcarty> ansx_: Or add the 'else ();' piece explicitly
lggr has quit [Ping timeout: 246 seconds]
<mehdid> ansx_: you can raise an exception in the else-branch
<mehdid> (depends on what you're doing though)
<ansx_> hmm but there is something I don't understand then
<ansx_> the odd function should return a boolean in all cases
<ansx_> hm well ok the if is not the last expression so I can return pretty much whatever I want there
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.7]
err404 has quit [Remote host closed the connection]
djcoin has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
hongboz has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
BiDOrD has joined #ocaml
lggr has quit [Ping timeout: 265 seconds]
BiDOrD_ has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
ousado has joined #ocaml
ousado has quit [Changing host]
ousado has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
<rwmjones> Stephane Glondu around? I thought his nick was 'glondu'?
lggr has quit [Ping timeout: 256 seconds]
<adrien> sgnb: ^
lggr has joined #ocaml
<rwmjones> sgnb: ping
lggr has quit [Ping timeout: 244 seconds]
<fasta> How can I remove a directory in OCaml in a platform independent manner?
lggr has joined #ocaml
<fasta> I can remove files in a platform independent way, but that doesn't work for deleting directories :/
<hcarty> fasta: If Unix.rmdir works under Windows then that's one way
<fasta> hcarty: why would it work? Windows!=Unix.
<fasta> hcarty: I suppose that would only work under e.g. Cygwin.
<hcarty> fasta: Most (?) of the Unix module works under Windows as I understand
<fasta> If that's the case, then the module system is not being used like it should.
<hcarty> fasta: Despite the name, it's not *nix, Cygwin only
<hcarty> fasta: At this point I expect that there are backwards-compatibility reasons for the naming
<fasta> hcarty: sure, but for new code, they could introduce a Directory module.
<adrien> "Unix" is because it's modelled after the API you find on unix
<adrien> but you have to remember that API has modelled POSIX and C
<adrien> also, checkout the sources of ocaml
<adrien> you'll find a windows implementation of Unix
<adrien> "of the Unix module"
<ansx_> are you aware of any way to lock memory in ocaml?
<fasta> adrien: are all OCaml modules documented well .. in the documentation?
<ansx_> any equivalent to the mlock/mlockall syscalls.
<hcarty> fasta: The core stdlib modules are documented well
<adrien> memory locking, check inside ocamlnet
<fasta> hcarty: The documentation for Sys.remove could be better. It says it removes a 'file', but a directory is also a file, yet it doesn't remove those.
<hcarty> fasta: You could submit a bug report
lggr has quit [Ping timeout: 240 seconds]
<adrien> also, ocaml-fileutils has some nice function
<adrien> s
osa1 has joined #ocaml
lggr has joined #ocaml
NMF has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
eikke has quit [Ping timeout: 265 seconds]
<fasta> Is Array.length O(1)?
<fasta> (another missing documentation item)
<flux> fasta, yes
<flux> actually it was one point I made when I familiarized myself with OCaml
<flux> without knowhing how OCaml linked lists were implemented, it didn't seem obvious to me that List.length x must be O(n)
<adrien> heh
<flux> (whereas C++ templated datastructure libraries always tell their complexity)
<adrien> as far as I'm concerned, I'm seeing it the other way round
nitraat has joined #ocaml
<adrien> ocaml linked lists are linked lists, plain and simple :-)
<adrien> so no weird tricks ;-)
<flux> adrien, and how would you know that without looking how they are implemented?-)
lggr has joined #ocaml
<nitraat> hi everyone! can someone help me out with a question about Scanf.bscanf ?
<adrien> flux: it's canonical!
<flux> adrien, so it follows from knowing the rest of the language :)
<fx_> so std::list::size is O(what?)
<flux> adrien, so the documentation says ocaml linked lists are the plain canonical implementation of linked lists without no additional information?-)
<adrien> flux: in doubt, they should :P
<fasta> Which pattern catches this? Exception: Unix.Unix_error (Unix.ENOTEMPTY, "rmdir" ...
<flux> fasta, cplusplus.com might not be the best reference but it says (http://www.cplusplus.com/reference/stl/list/size/): Constant (recommended). Linear in some implementations. - basically "implementation dependant"
<flux> oops, fx_
<adrien> flux: Unix.handle_unix_error
<flux> fasta, try .. with Unix.Unix_error (Unix.ENOTEMPTY, "redir", _) -> ..
<adrien> erf, fasta ^
<adrien> it's one possibility
<flux> oops, rmdir
<flux> (one thing I don't like about is those string arguments in exceptions where you would like to know the reason ;) )
<adrien> fasta: but if you have more file operations to do, look at ocaml-fileutils
<flux> man, it's becoming one of those "I don't like OCaml because.." but I really do like it ;)
<fasta> I also keep getting: Error: Reference to undefined global `Unix'
<flux> ansx_, btw, regarding that earlier discussing: if it has a value, it's an expresion
<fasta> I already have #load "Unix.cma";;
<flux> ansx_, so let a = 42 doesn't have a value, it's a statement saying from now on, a is equal to 42
<flux> ansx_, where as let a = 42 in b does have a value, namely the value of "b"
<adrien> flux: lowercase 'u', and you're in the toplevel?
<flux> adrien, bad day for tab expansions :)
<fasta> adrien: yeah, that iwas it.
<flux> fasta, didn't it say an error for Unix.cma?-o
<ansx_> flux: what about memory locking? do you have any equivalent to mlock in ocaml?
<adrien> flux: definitely
<hcarty> ansx_: There is a reference here - http://people.redhat.com/~rjones/hvcalls/
<fasta> flux: the toplevel does.
<flux> ansx_, I don't think it would work with ocaml data structures, because they can be moved around by gc
<fasta> flux: the interpreter doesn't.
<adrien> flux: actually I should go home since my screen look like an impressionist painting
<adrien> very blurry :P
<ansx_> I've seen some mlock implementation in xenstore (which is built it ocaml) but they have very specific needs and limitations
<flux> ansx_, I suppose you could disable the compacting GC and then just write bindings for mlock (a simple task)
lggr has quit [Ping timeout: 245 seconds]
<ansx_> yeah by c ompaction :)
<ansx_> but I was wondering if you mark some object as being "non movable"
<adrien> ansx_: what do you want to use it for?
<ansx_> yeah that's what the Xen guys did
<ansx_> but it's no good
<flux> ansx_, I don't think you can pin your value down.. but what you can do is have a C pointer to an ocaml data structure, as long as the C pointer is marked as a GC root
<hcarty> ansx_: I think the Ancient module can take a value out of the GC's reach. It's more focused on large, on-disk storage though.
<ansx_> adrien: for storing cryptographic secrets
<flux> ansx_, and then yuo can have memory allocated outside the ocaml memory management, as hcarty says
<flux> but it's not as safe anymore as regular memory
<ansx_> so ocaml by itself is not capable of storing cryptographic secrets ?
<ansx_> neither from securely erasing them...
<flux> ansx_, well, you can mlock the whole process I imagine, that doesn't require pinning values down
<flux> (at least in principle, I haven't tried, and you still need a few lines of C to do it)
<ansx_> yeah but that's not acceptable for production applications :)
lggr has joined #ocaml
<flux> or you can keep the secrets in C-allocated memory and have a pointer to that in OCaml
<hcarty> Bigarrays would be helpful there
<flux> right, bigarrays could be mlocked, they are basically C-allocated data structures
<ansx_> hm yeah but I'd rather avoid using any C
<flux> bloody annoying how easily google eliminates 'boring' keywords
<flux> such as mlock..
<adrien> I'd really look at ocamlnet
<fasta> flux: "mlock"?
<ansx_> actually that's like saying "Java support monads if you implement them via a C extension"
<flux> Lwt_mmap apparently has bindings for mlock
ftrvxmtrx has quit [Quit: Leaving]
<flux> fasta, mlock is a system call instructing the kernel to never write the pages to disk
<fasta> flux: I was explaining to you how to use a search engine.
<flux> fasta, ah :)
<flux> fasta, yeah, I do that
<flux> it used to work to do +mlock, but now you need "mlock"
<flux> but how should I guess which words it is going to ignore? "just" "quote" "everything"?
<ousado> yes they removed '+', and more importantly '-'
<fasta> +mlock and "mlock" have different results. I wonder who made that up.
<fasta> ousado: no replacement for -?
<flux> - works still
<flux> according to my quick test
<fasta> Yeah, it does so here too.
<adrien> ddg!
<flux> I actually tried ddg for a while as my default search engine, but noticed that too often I needed to swap to google to find what I wanted
<flux> maybe I shall try bing next time!
<ousado> huh yes
<_habnabit> flux, ddg uses bing
<flux> _habnabit, as its sole search engine?
<_habnabit> IIRC yes
<flux> so, I've tried bing already then.. well, google it is for me, then :(
<flux> if I had a personal search engine that indexed all my history and bookmarks + 2 levels, I would be probably set pretty good for finding stuff
lggr has quit [Ping timeout: 255 seconds]
<flux> or maybe not.. it might be difficult to determine relative 'importance' of data from such a small data set, even if the pages I'm looking for are there.
<fasta> flux: you can install your own personal search engine, which indexes every page you visit.
<flux> I used to have breadcrumps installed on my browser for a while
<flux> but then I switched computers :)
<flux> (breadcrumbs = stores every page I visit)
mika1 has quit [Quit: Leaving.]
cago has quit [Quit: Leaving.]
<flux> also I should put the pages on some other machine instead of my limited-storag laptop..
<fasta> flux: but you cannot search in breadcrumbs, I suppose?
<flux> it has a primitive keyword search
<flux> but I could put some indexer like glimpse do it as well
<flux> fasta, did you have some suggestion for a personal search engine?
lggr has joined #ocaml
<fasta> flux: Yacy can be used.
<fasta> flux: I don't think it's that great.
<fasta> flux: but it does scale to some degree.
<fasta> Modern search engines require a ton of data to work correctly.
<fasta> (and also use your usage patterns)
<hcarty> flux: Do you have a pointer to Lwt_mmap?
<fasta> (and the data patterns of other users)
<fasta> For example, I am sure that Google basically just analyzes at every query what you are doing.
<fasta> E.g. 'solving a problem', abandoning a problem, etc.
<fasta> Then when you are done solving a problem the latest link you clicked on will get some positive reinforcement.
<flux> bloodyhell, lwt_mmap -> no points, "lwt_mmap" -> first hit :P
<hcarty> flux: Thanks :-)
<fasta> That is then likely input as one signal in their ranking algorithm.
<flux> (I really used just my orignial search to find it, but then tried that as well)
<hcarty> That's interesting. It's not in the main online Lwt documentation.
<fasta> Probably there are 100s of such signals.
<flux> hcarty, maybe it's not part of the official lwt distribution.. "lwt-plus"
<flux> fasta, hmm, 100s per person.. sounds a VERY big amount of data
<flux> maybe fewer would do to differentiate from the competition
<flux> and clearly it's not smart enough to understand that lwt and mmap are terms of my domain ;)
<fasta> flux: there is also a thing called economics.
<fasta> flux: same reason why you cannot search for full paragraphs.
<flux> hmm, full paragraph search should be easy
<flux> just pick a non-common part of it and search from the subset ;)
<fasta> flux: yeah
<fasta> flux: but apparently they didn't do that, because users can also do that.
<fasta> flux: and hence save money.
<fasta> flux: or they had more pressing concerns ;)
<flux> maybe they want to rather learn how to search the right result without requiring the quotes
<fasta> flux: yeah, very plausible.
lggr has quit [Ping timeout: 255 seconds]
<fasta> Still, I think that Google will probably be taken over by some guy in a basement who will invent actual AI in 15 years or so.
<hcarty> flux: lwt-plus was apparently merged with Lwt
djcoin has quit [Quit: WeeChat 0.3.7]
<hcarty> flux: Perhaps Lwt_mmap didn't make the cut
<ansx_> ok I'll take a look at lwt mmap tomorrow
<ansx_> thank you for the insight
lggr has joined #ocaml
<flux> ansx_, oh, it was an actual guestion, instead of just general interest ;)
<flux> fasta, nice, there are even debian packages, maybe I shall try that Some Day(TM)
<fasta> flux: there is also a version which you can use on the web.
<fasta> flux: that is, a public web site.
lggr has quit [Ping timeout: 248 seconds]
<flux> fasta, it seems quite interesting. I passed the link on, thanks for the pointer :)
<fasta> flux: it also seems to suck less than two years ago.
<fasta> flux: i.e., I can find things now. What was your query that Google had trouble with?
<fasta> flux: never mind ;)
lggr has joined #ocaml
<fasta> flux: you can also direct it to index some domains completely, but often you get banned for doing that.
<fasta> flux: even if you are following the robot.txt.
Yoric has quit [Ping timeout: 265 seconds]
<flux> fasta, I apparently got 83 results.. no actual results visible, though :). but maybe it works for local indexing ;)
lggr has quit [Ping timeout: 255 seconds]
<fasta> flux: or all the nodes are overloaded.
err404 has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
Sablier has joined #ocaml
sivoais has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
beckerb has quit [Ping timeout: 260 seconds]
sivoais has joined #ocaml
<wieczyk> Lame question, i Have src/Main.ml and want to produce binary named ,,Opifex'', how to do it by ocamlbuild? I ccanot see any -o option, I invoked 'ocamlbuild -Is src src/Main.native'
ftrvxmtrx has joined #ocaml
<fx_> wieczyk, no way, use post-build step to rename the binary
<wieczyk> ;/
lggr has quit [Ping timeout: 255 seconds]
<flux> I guess you -could- do that in myocamlbuild.ml
<flux> no idea how :)
<fx_> myocamlbuild - yes
<fx_> but simple shell is simple
<wieczyk> It is a bit weird that I cannot control binary name in build system.
lggr has joined #ocaml
eikke has joined #ocaml
chambart has quit [Ping timeout: 260 seconds]
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
<wieczyk> Another weird thing in Ocamlbuild is a file named "_tags". It is weird because we have a well-known tools for generating tags for editors like vim, emacs, etc. And tag,tags,_tag,_tags,TAG,TAGS etc are popular names for output of those tools.
<thelema> I've seen TAGS, not _tags so much
<pippijn> prefix _ is nice in sorted file lists
<pippijn> just like .
<pippijn> upper-case names are nice, too
<pippijn> except when you use java, because then everything is uppercase
ski has quit [Ping timeout: 245 seconds]
ski_ has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
avsm has joined #ocaml
<pippijn> oh boy..
<pippijn> I think I'm doing something wrong
<pippijn> the build is taking very long
<pippijn> 9 minutes now
<adrien> generating C++ code?
<pippijn> compiling ocaml code
<adrien> recursive definitions?
<pippijn> 842M _build
lggr has quit [Ping timeout: 248 seconds]
eikke has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
<pippijn> I need an 8 core laptop
<adrien> you need a desktop
<pippijn> yes
<pippijn> but I'm in china
<pippijn> I don't have a desktop here
<pippijn> I think it's the casting
thomasga has quit [Quit: Leaving.]
<pippijn> yeah, it is the casting..
lggr has quit [Ping timeout: 246 seconds]
<pippijn> or maybe it isn't
lggr has joined #ocaml
<pippijn> I don't get it
<pippijn> it *is* the casting
<adrien> some things that I know can cost: objects, recursive definition, polymorphic variants, casting
<adrien> among these, recursive (or very big) definitions are the worse
lggr has quit [Ping timeout: 245 seconds]
nicoo is now known as Link
<thelema> what's the cost of casting?
<pippijn> thelema: enormous
<thelema> for what?
<pippijn> I have no idea, but I'll give you numbers, soon
Link is now known as Guest57897
<thelema> there's no runtime representation of typecasts
<adrien> pippijn: also: casting or type constraints?
<pippijn> adrien: :>
<thelema> so you're talking only compile-time costs
<pippijn> thelema: code size costs
<thelema> but it shouldn't be any worse than having a function that converts from one to the other
<adrien> well, I can picture it take time
<thelema> code-size is increased by casts?
Guest57897 is now known as nicoo
<pippijn> extremely
<adrien> I cannot picture it turn the compilation O(n^2)
<adrien> pippijn: your ocaml code is machine-generated, right?
lggr has joined #ocaml
<pippijn> yes
<adrien> so make the generator output code that is a bit less awful :P
<pippijn> I tried
<pippijn> I put the cast into its own function
<pippijn> but I guess it inlines that
<pippijn> it didn't help at all
<adrien> you really really really need the casts everywhere?
<pippijn> well
<pippijn> no, I guess not
<pippijn> I could let the client code cast
<adrien> that's not what I meant :P
<adrien> also, show the code
<pippijn> 110M _build
ontologiae has quit [Ping timeout: 256 seconds]
<pippijn> thelema: 110M vs 842M
<thelema> pippijn: wow, that's quite an overhead. all for casts?
<pippijn> yes
<thelema> that's odd; I thought that typecasts had no runtime representation, and they were type level constructs that got erased at some compilation stage (probably when the types were erased)
<pippijn> if as_methods is defined as: let as_methods self = (self :> methods)
sepp2k1 has joined #ocaml
<pippijn> 110M becomes 842M
<adrien> thelema: rule 1 of machine-generated code
<adrien> it *SUCKS*
<adrien> my eyes
<flux> pippijn, maybe if you're 100% sure your casts are ok, maybe Obj.magic can speed them up?
<pippijn> flux: I could do without casts
<flux> oh, object casts
lggr has quit [Ping timeout: 256 seconds]
<adrien> it's not because your code is generated that you can't use "module X = SuperLongName"
<pippijn> yep
<flux> maybe object casts actually result in code being generated
<pippijn> adrien: hehe
<pippijn> flux: apparently a lot of code, yes
sepp2k has quit [Ping timeout: 264 seconds]
<adrien> pippijn: that's the whole code?
<pippijn> adrien: no, there are more files like this
<adrien> how many? what are the sizes for this one?
<flux> pippijn, perhaps you should address the caml-list with this :)
<flux> knowing qt there are probably hundreds of files like that..
<pippijn> 899,479 bytes in 207 files
<adrien> *this* one
<pippijn> o
<pippijn> h
<pippijn> 67K (cmo) 47K (o) for no-cast
<flux> so when we finally get to use the bindings, our binaries will be 900 megabytes :)
<flux> (actually 110M is quite a lot already..)
<adrien> pippijn: what about the base file?
<pippijn> 123K/47K for with casts
<flux> was that byte code or native?
<flux> with or without debug info?
<pippijn> with
<thelema> with debug info is the only correct way to compile a library for distribution
<pippijn> 123 without debug info
<pippijn> -tag release
lggr has joined #ocaml
<pippijn> hm, it doesn't seem to matter
<pippijn> ah wait
<pippijn> 14K without debug
<pippijn> the .o is still 46K
<adrien> pippijn: show the base class
<adrien> how big is the output?
<pippijn> the base class of that one is small: http://paste.xinu.at/xNd/
<adrien> how big is the output file?
<pippijn> 8K/9K
<pippijn> cmo/o
tufisi has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 246 seconds]
<pippijn> I'm going to let the client code cast
<pippijn> by the way, I currently pass everything to C++ in the StackItem.value variant
<pippijn> that's not strictly necessary
<pippijn> I can Obj.magic everything
<pippijn> but for now, I keep it this way, so I have runtime type checking on both sides
<pippijn> that probably costs, too
<pippijn> all those caml_allocs for the stack items
lggr has joined #ocaml
<flux> if it's possible to compile just as working library with or without Obj.magic, the only hmm functional difference being the size, then perhaps it's something that could be implemented in the future
<pippijn> sure
<pippijn> while I'm developing it (and I don't really have a clue about ocaml FFI), I'm keeping it this way
chambart has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
<thelema> possibly having factored the cast out as a function is causing the debugging size to increase
<pippijn> thelema: it doesn't matter, at all
<pippijn> it's the same size as function or in-line
<thelema> hmm, why do casts cost so much in .cmx size...
<thelema> maybe something to do with the inliner...
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
<Ptival> have people tried to lock some memory in OCaml?
<thelema> Ptival: lock memory for what?
lggr has quit [Ping timeout: 260 seconds]
doomlord has joined #ocaml
<Ptival> rwmjones: ^ I see in http://people.redhat.com/~rjones/hvcalls/ you just wrap around mlock/munlock
<pippijn> great.. of course C++ has mutual dependencies between modules
<Ptival> thelema: in RAM
<pippijn> that's just brilliant..
<pippijn> bye bye static type checking
<doomlord> how convinient is serializing in ocaml.. what does it have out of the box
<thelema> pippijn: let rec module A : A_sig = Astr and B : B_sig = Bstr ...
<thelema> doomlord: the module Marshal can serialize to string or IO channel arbitrary ocaml values, including function pointers and cyclic structures
<pippijn> thelema: then I need to put all qt modules into one file
<thelema> pippijn: probably, yes
<pippijn> is that a good idea?
<thelema> pippijn: it has its disadvantages
lggr has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
<doomlord> does it have a literal format for maps inbuilt like clojure { :key1 value1 .:key2 value2 ... } .. i like the JSON idea of a language with its own literals as a human readable serializing format, but would at least tweak json to not quote everthing in maps
<thelema> doomlord: ocaml has list and array literals only, no literal format for maps. The Marshal format is not human readable.
<adrien> pippijn: recursive modules won't compile fast either
lggr has quit [Ping timeout: 244 seconds]
thomasga has joined #ocaml
* thelema is happy that it looks like garrigue is working on fixing the record name issue: "use types to disambiguate record access" https://github.com/thelema/ocaml-community/commit/6dcc770e622c5503725826bc5c4a656d4fdaf08b
lggr has joined #ocaml
emmanuelux has joined #ocaml
<adrien> :o
NMF has quit []
lggr has quit [Ping timeout: 244 seconds]
<Ptival> that would be cool
lggr has joined #ocaml
<pippijn> adrien: if it takes less than 5 minutes for one file, it's faster than what I have now
<adrien> pippijn: take a couple of files that give you the issue, compile them by hand
<adrien> dichotomize over the source code in order to try to find a big speedup
<pippijn> all files give me the issue
<adrien> take the most basic ones I mean
<adrien> it'll take you around 30 minutes probably
<pippijn> ah
<pippijn> yes, good idea
lggr has quit [Ping timeout: 260 seconds]
<pippijn> adrien: besides the cast, I don't think there is much I can do
<pippijn> QObject is fine
<pippijn> QWidget is slow, because it's big
<pippijn> 33K
<pippijn> 336 lines of code
<pippijn> I wonder if the "include" thing is bad
lggr has joined #ocaml
<pippijn> haha
<pippijn> "include" is *very* bad
<pippijn> that's sad :(
<pippijn> 1 second without include, 9 seconds with include
<pippijn> so, is what I'm doing with include a bad idea?
<pippijn> I thought that is the way to inherit modules
pangoafk is now known as pango
lggr has quit [Ping timeout: 245 seconds]
<thelema> apparently namespace operations are expensive at compiletime.
<thelema> the core people are noticing that "open Core.Std" takes 3 seconds of script startup time
<thelema> hmm, I'm kind of surprised that batteries doesn't have as slow a startup
<pippijn> 111K/73K without include
<pippijn> 187K/135K with include
lggr has joined #ocaml
<pippijn> I think it generates forward-functions for every function
<thelema> pippijn: not same functionality, right?
<thelema> (between the without include and with include)
<pippijn> thelema: the difference is "include BaseModule.Static"
<thelema> can you resolve just the parts you need and do let x,y,z = BaseModule.Static.(x,y,z)?
<pippijn> I am wrapping Qt
<thelema> or would that just be listing all of BaseModule.Static?
<adrien> pippijn: how big is the module you include?
<pippijn> and I would like inherited static and non-virtual methods to be accessible through the derived module
<pippijn> adrien: bigger and bigger the further down the inheritance tree you get
<pippijn> QTableWidget is quite far down
<thelema> ah, I see. `include` is the right way to go; sad that it's so expensive
<pippijn> without "include", the whole library compiles in 40 seconds
<thelema> that sounds about right.
<adrien> you include include of includes of includes of includes of ... ?
<pippijn> adrien: yes
<adrien> doesn't sound inexpensive :-)
<adrien> you compile as bytecode or nativecode right now?
<flux> maybe the compiler could be fixed
<flux> what I'm guessing is that it checks every include depth separately (O(depth)), whereas it could perhaps use some other structure for it..
<pippijn> also, it's 52M
<pippijn> instead of 110
lggr has quit [Ping timeout: 246 seconds]
thomasga has quit [Quit: Leaving.]
<pippijn> the _build directory
<pippijn> 605239 245968 53184 904391 dccc7 _build/testsuite/test
<pippijn> let's see what the size of my test is with includes
<adrien> do you compile as bytecode or nativecode right now?
<pippijn> that one is native
<pippijn> the library is both, the test is native
<adrien> is bytecode much fast?
lggr has joined #ocaml
<pippijn> good question
<pippijn> I'll try that after this
sepp2k1 has quit [Read error: Connection reset by peer]
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
<pippijn> so, 6 minutes with include, 40 seconds without include
avsm has quit [Quit: Leaving.]
<pippijn> 720300 264088 53184 1037572 fd504 _build/testsuite/test
<pippijn> the resulting binary is not that much bigger
<pippijn> -rw------- 1 pippijn pippijn 12M Sep 28 03:22 _build/mlsmoke/mlsmoke.a
<pippijn> adrien: yes
<pippijn> adrien: bytecode is *much* faster
<pippijn> adrien: bytecode is immediate, just like without include
lggr has joined #ocaml
<adrien> can you guess why?
<pippijn> I can make wild guesses
<adrien> shoot, I've done the same ;-)
<pippijn> build from scratch without include takes 39 seconds
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
<fasta> pippijn: are you mapping one class to one module?
<pippijn> yes
<pippijn> bad idea?
<pippijn> I wonder what happens if I flatten the hierarchy myself, listing all inherited functions in every module
<pippijn> I'll probably blow up the code size
Associat0r has joined #ocaml
<adrien> have you understood lablgtk's use of polymorphic variants btw?
<pippijn> I don't really know anything about lablgtk
<pippijn> let me check the code
lggr has quit [Ping timeout: 244 seconds]
<thelema> pippijn: lablgtk does amazing things with polymorphic variants
<thelema> we shouldn't be surprised; it was written by the inventor of OCaml's polymorphic variants
<pippijn> hmm
<Associat0r> here's some explanation of the patterns they use in lablgtk http://mirror.ocamlcore.org/ocaml-tutorial.org/labels.html
<adrien> it'll probably take you some time to understand what it does, why and how you can use it too (or not!=
<adrien> hmm
<adrien> )
<pippijn> ah yeah
<pippijn> type menu_item = [item|`menuitem]
<adrien> I find the ocaml-tutorial link to explain variants but not what is in lablgtk
<pippijn> and type -'a obj
<pippijn> okay
<pippijn> I don't understand :)
<thelema> Associat0r: that content is now available at http://www.ocaml-lang.org/tutorials/labels.html, and can be edited via github
<Associat0r> thanks
<thelema> pippijn: -'a has to do with variance
lggr has joined #ocaml
<pippijn> I understand that part
<pippijn> but I don't know what it's doing with polymorphic variants
<thelema> it's establishing the interitance pattern
<pippijn> at the moment, I'm trying to map C++ to ocaml directly
<pippijn> like lablqt
<adrien> don't spoil his fun too much :P
<adrien> pippijn: lablgtk's Gtk* modules are a direct mapping
<adrien> G*modules are another layer
<adrien> use of polymorphic variants is in the Gtk* modules
<pippijn> actually I think I do need polymorphic variants, as well
<pippijn> I thought about it before
<adrien> I believe polymorphic variants can probably reduce your need for module inclusions
<adrien> but that's quite a guess
<adrien> so I'd say: think about them for some time and then decide what to do
emmanuelux has quit [Remote host closed the connection]
<pippijn> well
lggr has quit [Ping timeout: 256 seconds]
<pippijn> yeah, but I'm not there yet
<pippijn> I'm also still thinking about marshalling
<thelema> pippijn: marshalling Qt objects?
<pippijn> yes
<thelema> I guess you get custom blocks for that
<adrien> marshalling functions? :P
<pippijn> yes
<pippijn> adrien: yes
<pippijn> thelema: yes
<pippijn> thelema: it depends
<pippijn> I'll keep raw pointers to QObjects
lggr has joined #ocaml
<pippijn> and custom blocks for the rest
<pippijn> but even just one step after int/string/unit (namely int ref to int*) is unsolvable for me at the moment
<pippijn> if a method takes int* or int&, will it keep that pointer or reference?
<pippijn> if it keeps the pointer, then for how long?
<thelema> pippijn: yes, this is usually the problem with C/C++ bindings
<pippijn> QApplication::QApplication(int&, char**)
<pippijn> this keeps the int reference for the object's lifetime
<pippijn> which is usually the program's lifetime
<thelema> you need more information than what is in the function signature to handle this properly.
<pippijn> yes
<pippijn> I don't even know what to do with char*
<pippijn> is it going to write to that string?
<pippijn> also, everything I call can potentially call back into ocaml
avsm has joined #ocaml
<pippijn> and with Qt, it usually does
<pippijn> because everything causes events
<pippijn> const QDate& is easy
lggr has quit [Ping timeout: 248 seconds]
<pippijn> that's just a value type like int
<pippijn> it goes into a custom block and I'm done with it
<pippijn> when it takes a const QSomething&, it means it will not keep the reference until after the call
<pippijn> because it might be a temporary
lggr has joined #ocaml
<pippijn> non-const references probably want to update a value
<pippijn> so in ocaml, I could pass a ref and update it after the call
<pippijn> or I could pass a value and return a tuple containing the updated value
<pippijn> I have no idea what happens to pointers to const
<pippijn> FILE* is something I probably can't handle at all
avsm has quit [Ping timeout: 260 seconds]
<pippijn> QByteArray* is used in some objects that require me to manage the byte array's memory but they keep a reference to it
_andre has quit [Quit: leaving]
<pippijn> so it's my job to make sure the byte array outlives that object
Xizor has joined #ocaml
<pippijn> perlqt4 has a huge marshalling machinery
<pippijn> really huge.. I don't think I'll need that much with ocaml
lggr has quit [Ping timeout: 252 seconds]
<pippijn> because perl has to handle dynamic typing
lggr has joined #ocaml
<fasta> pippijn: if you don't know the role of a parameter, can't you just generate some random code, inspect the memory map afterwards to derive its most likely effect and use that as information to generate a proper type signature?
lggr has quit [Ping timeout: 255 seconds]
Sablier has quit []
lggr has joined #ocaml
emmanuelux has joined #ocaml
pango has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 255 seconds]
pango has joined #ocaml
lggr has joined #ocaml
tizoc has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
avsm has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
cdidd has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
cdidd has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
eikke has joined #ocaml
Xizor has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
cdidd has quit [Ping timeout: 246 seconds]
cdidd has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
ontologiae has joined #ocaml
lggr has joined #ocaml
bobry has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
Cyanure has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
cdidd has quit [Read error: Connection reset by peer]
ftrvxmtrx has joined #ocaml
cdidd has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
avsm has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 240 seconds]
eikke has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
Cyanure has joined #ocaml
nitraat has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
err404 has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 246 seconds]
chambart has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
avsm has joined #ocaml
Cyanure has quit [Remote host closed the connection]
avsm has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
Yoric has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
cdidd has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
cdidd has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
lggr has joined #ocaml
avsm has quit [Ping timeout: 256 seconds]
lggr has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
<wmeyer> avsm: laura greeted
lggr has joined #ocaml
<avsm> wmeyer: sounds like an excellent turnout!