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
companion_cube has joined #ocaml
pango_ has quit [Ping timeout: 240 seconds]
bobzhang has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<thelema> ...
<thelema> drat, just missed
ftrvxmtrx_ has quit [Read error: Connection reset by peer]
sebz has quit [Quit: Computer has gone to sleep.]
letrec has quit [Remote host closed the connection]
letrec has joined #ocaml
ftrvxmtrx has joined #ocaml
critter has joined #ocaml
critter has quit [Quit: Page closed]
pilki has joined #ocaml
<hcarty> thelema: --all and --help added; README instructions fixed; New, even simpler method of doing "ocamlbrew --all" pinched from perlbrew
pilki has quit [Quit: This computer has gone to sleep]
<hcarty> thelema: Using the latest odb and a fresh ocamlbrew installation, oasis fails to install due to what appears to be an incorrect PCRE version check
fantasticsid has joined #ocaml
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
fantasticsid has joined #ocaml
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
fantasticsid has joined #ocaml
bitbckt has quit [Quit: out]
bitbckt has joined #ocaml
waterfowl has joined #ocaml
waterfowl has quit [Ping timeout: 244 seconds]
emmanuelux has joined #ocaml
unmerged has joined #ocaml
edwin has joined #ocaml
sebz has joined #ocaml
emmanuelux has quit [Quit: Ex-Chat]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
sebz has quit [Client Quit]
pango_ has joined #ocaml
raichoo has joined #ocaml
sebz has joined #ocaml
pango__ has joined #ocaml
pango_ has quit [Ping timeout: 252 seconds]
iago has joined #ocaml
iago has quit [Remote host closed the connection]
iago has joined #ocaml
unmerged has quit [Quit: leaving]
fridim_ has joined #ocaml
fantasticsid has quit [Ping timeout: 268 seconds]
fantasticsid has joined #ocaml
<Drakken> How do you uninstall godi?
<adrien> rm
<adrien> -r
<Drakken> adrien thanks
iago has quit [Remote host closed the connection]
<adrien> Drakken: unless it for a reinstall, I'd typically remove the GODI paths from the PATH environment variable and only delete the GODI prefix once I'm 100% sure I'm not using it
<Drakken> adrien don't worry, I won't delete anything until I'm sure :)
<adrien> =)
fantasticsid has quit [Ping timeout: 252 seconds]
oc13 has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
h0x00 has joined #ocaml
UncleVasya has joined #ocaml
sebz has joined #ocaml
pilki has joined #ocaml
h0x00 has quit [Read error: Connection reset by peer]
h0x00 has joined #ocaml
pilki has quit [Quit: This computer has gone to sleep]
<samposm> in which case would one need .cmo file instead of .cma ?
milosn has quit [Ping timeout: 268 seconds]
milosn has joined #ocaml
pilki has joined #ocaml
h0x00 has quit [Read error: Connection reset by peer]
h0x00 has joined #ocaml
pilki has quit [Quit: This computer has gone to sleep]
h0x00 has quit [Read error: Connection reset by peer]
h0x00 has joined #ocaml
h0x00 has quit [Client Quit]
ulfdoz has quit [Quit: deprecated]
<samposm> jesus, why does ocamlmklib make a .a, if you also need the .cmxa and the original C code .o
<adrien> samposm: you're making your whole build system on your own and from scratch?
<adrien> s/system/infrastructure/
<samposm> I wrote a makefile, yes
<adrien> can I suggest you should use one of: 1- OCamlMakefile, 2- oasis, 3- maybe omake (I'm not sure it handles C bindings)
<samposm> I just don't undestand what is even in the .a, if the C object code is in the original .o and the ocaml code is in the .cmxa
<samposm> adrien: yeah but I'd love to *understand*
<adrien> :-)
<adrien> samposm: how do you invoke ocamlmklib btw?
<samposm> ocamlmklib -o _foo fooc-wrap.o fooc.o
<adrien> ok; because one mistake is to have the build set so that several programs create the same .o/.a files
<samposm> al least my c source files and ocamls source file have different names
<adrien> should be good then
<samposm> maybe I'll put a question in stackoverflow
<adrien> have you inspected your files with a tool like "nm"?
<adrien> I do C bindings but I've long forgotten the details of the build procedure
<adrien> but also, there's Florent Monnier's page about wrapping C in OCaml; it's quite good (in case you haven't already seen ità
<adrien> )
<samposm> I have read it
<samposm> it does not really exaplain, that is I have 1 ocaml source file and some C .o's, why do I get *9* files after compiling my library
<samposm> and wheter all of the 9 files are needed or not
<adrien> according to nm, the .a for the C code contains the symbol from the .o file; nothing more and nothing less
<adrien> also, what are you 9 files and your input files?
* adrien will have to go pretty soon
<samposm> foo.a foo.cma foo.cmi foo.cmo foo.cmx foo.fmxa foo.mli dll_foo.o lib_foo.a
<adrien> you don't need the cmo later on
<adrien> the cmx will only be used for inlining in native code
<samposm> ah, that's a good reason
<adrien> and you don't have a .so file?
<adrien> .mli file is also created?
<samposm> sorry, typo, that was not dll_foo.o but dll_foo.so
<adrien> .so file is because the bindings will be dynamically loaded at runtime for _byte_code iirc
<adrien> .a file is because the bindings will be statically linked for _native_ code iirc
<samposm> yes, I know that .co contains the C part needed be .cma
<adrien> you get many files because you have both native and bytecode
<samposm> I kinda sorted it yout so far, thet .cmi, .cma and .so are needed for bytecode
<adrien> you're going to _need_: .cma, .cmi, .cmxa, .so, lib_foo.a; .cmx is better if provided, and the "foo.a", I think you need it too
<adrien> providing the .mli is also a good idea since it shows the interface of the module; kind of documentation
<adrien> be bacj later
<adrien> back*
UncleVasya has quit [Read error: Connection reset by peer]
<samposm> ok, here's my stackoverflow question, but only about bytecode things so far http://stackoverflow.com/questions/8630599/is-there-a-reason-to-retain-cmo-or-only-cma
sebz has quit [Quit: Computer has gone to sleep.]
pilki has joined #ocaml
pilki has quit [Client Quit]
emmanuelux has quit [Remote host closed the connection]
<Drakken> How does findlib find godi packages?
<hcarty> Drakken: All GODI packages are setup to use findlib
<hcarty> META files, proper install paths, etc.
<Drakken> hcarty but how does findlib know where I installed godi?
emmanuelux has joined #ocaml
<hcarty> Drakken: GODI configures findlib to look in the appropriate directories
<Drakken> hcarty do you know how it does that?
<mfp> samposm: in general, you can get rid of the .cmo once you have the .cma. The only reason to keep the .cmo I can think of is to link against only a subset of modules that don't use externals declared in the cma.
<hcarty> Drakken: findlib automatically sets itself up to install alongside whatever OCaml installation is used to compile it
<hcarty> Drakken: GODI may do some extra configuration after that
<Drakken> hcarty I installed findlib before I installed godi.
<hcarty> Drakken: See ocamlbrew's installation steps for one possible way to do this : https://github.com/hcarty/ocamlbrew/blob/master/ocamlbrew
<hcarty> Drakken: You need to use GODI's findlib with GODI's OCaml
<Drakken> hcarty that makes a lot more sense.
<Drakken> hcarty so can/should I uninstall the original findlib?
<samposm> mfp: you mean if one were to construct a .cma out of several .cmo's? (In this case I have only one .cmo which I use to construct the .cma)
<mfp> samposm: right, that'd only make sense if you had several .cmo and wanted to be able to link against only one of them w/o having to link against the .so containing the externals
<samposm> apparently, if my code refers to some C code, I can't even start the toplevel with "ocaml foo.cmo", only "ocaml foo.cma" works
<mfp> you'd have to build a new toplevel (ocamlmktop) in order to do the former
<hcarty> Drakken: Probably, unless you have another use for it, such as a separate OCaml installation you need to keep around and use.
<samposm> but if it were only ocaml code, not any C involved, them "ocaml foo.cmo" would work?
<mfp> yes
<samposm> thank you
<mfp> np
<Drakken> hcarty I hope I don't need more than one installation. I just want one system that has all the libraries I need, including Ocamlnet and yojson, which are available thru godi but apparently not thru odb.
<hcarty> Drakken: In that case there is no need to keep your non-GODI installation around.
<hcarty> Drakken: Also, you can use odb with GODI
<Drakken> hcarty thanks, that's what I wanted to know :)
<hcarty> Drakken: You're welcome - have fun
sebz has joined #ocaml
letrec has quit [Ping timeout: 244 seconds]
pilki has joined #ocaml
fschwidom has joined #ocaml
pilki has quit [Quit: This computer has gone to sleep]
pilki has joined #ocaml
<flux> ooh, trip of the day I picked from caml-list: resetting toplevel happens with Toploop.initialize_toplevel_env ()
<flux> maybe I'll put let reset () = .. to my .ocamlinit
pilki has quit [Client Quit]
<hcarty> That post was the first I had heard of it too. Quite a nifty trick.
<hcarty> It works in utop as well, apprently without causing too much damage to the custom interface
sebz has quit [Quit: Computer has gone to sleep.]
<flux> even better, the trick was accompanied with one you can use to do 'multiple contexts'
<flux> not sure if that's of any use, though
oriba has joined #ocaml
<hcarty> flux: It's cool, which has its merits :-)
<thelema> yes, quite a good find.
<hcarty> thelema: I think the odb error I ran into is due to match case ordering
<hcarty> thelema: ~L360
<thelema> hcarty: how's that? the first match case isn't being hit, as it's not exiting
<thelema> the second isn't being hit as it's not printing the "use force" message
<hcarty> The first is being hit - odb exits
<thelema> really? hmmm...
<thelema> I guess I'm having a different problem than you
<hcarty> If I swap the first and second then the installation completes
<thelema> the first match case is only when a dependency exists but ... hmmm...
<thelema> yes, it should only be when the dependency exists, but odb thinks it needs to be installed
<thelema> i.e. has_dep returns false for that dep
<thelema> oh... doh! timing.
<thelema> repeat dependency - a dep appears multiple places in the dep tree
<thelema> so it gets installed teh first time and then it thinks upgrade is necessary the second time
<thelema> hmmm...
<hcarty> thelema: Yes, I'm pretty sure that's what I hit.
<thelema> I think I'm going to drop the single-pass dep-tree-gen and go to a more incremental dep handling
Plex has joined #ocaml
<oriba> are there any simple DSL implementations around, where it is possible to have an inspiration from?
<oriba> I'm reasoning about my parsetrees and AST
<oriba> when to evaluate
<oriba> when to convert into a more abstract AST
<oriba> at whgich point would I go from interpreter to compiler?
<oriba> regarding the evaluation of the AST?
<oriba> Built-in functions generic or as part of the AST (started with the first, now I turned to the second option)
<oriba> converting the parsed strings directyl into a Sum-type or using a sum-type to mark the type and use the strin until the function call that represents the built-in (and then using sitring_of int x instead of match Sintval i -> .... ???
<oriba> so many possibilities
<oriba> Any idea?
<oriba> "Just a matter of taste!" ??
<thelema> oriba: lots of "it depends".
<oriba> yes that what I have "feared"
<oriba> I have changed my code more than once
<thelema> I'd stay on the interpreter level for a long time
<oriba> ech time I had some more insights
<oriba> I also want to stay at interpreter level first
<oriba> I also have compiler stuff in mind
<oriba> but I first want to have my interpreter iumplementing more and more featutes
<oriba> features
<oriba> At the moment I have a Parsetreetype, where Variables for example are represented as Varname pf string
<oriba> in one of my early implementations I ust used set_var <name> and get_var <name> when evaluating
<oriba> But it seems to be more flexible to have something like Getvar of string and Setvar of String as part of the AST
<oriba> the I may rearange the AST if necessary
<oriba> but there are a lot of other things I need to think about
<oriba> the rather direct evaluatoion is comparingly easy via partial application, where I can build the needed functions while walking through the tree
<oriba> But things like implementing my own sub-routines and parameters and types of them and typechecking and so on.
<oriba> Hey.. a lot of stuff
<thelema> yup, and the best way to learn is to do
<oriba> When looking at the BASIC-interpreter in the Ocaml-ORA-Book I found they used SumTyopes for representing the Built-in commands, so I used that now too in my latest ideas
<oriba> OK
<oriba> Learing by doiing is what I'm doiing now ;)
<oriba> but some inspiration by others also can help
<oriba> Thats why I asked for some example languages (which are not too big)
<oriba> At least I can state that the type system and the module system from OCaml do a huge benefit...
<oriba> It makes things clearer and possible to reason about what I'm doing...
<oriba> ...maybe instead of finding other examples, this stuff I'm working on might become an example for other people one day....
waterfowl has joined #ocaml
waterfowl has quit [Read error: Connection reset by peer]
waterfowl has joined #ocaml
iago has joined #ocaml
waterfowl has quit [Ping timeout: 244 seconds]
waterfowl has joined #ocaml
waterfowl has quit [Read error: Connection reset by peer]
waterfowl has joined #ocaml
BiDOrD_ has joined #ocaml
kmc has joined #ocaml
BiDOrD has quit [Ping timeout: 255 seconds]
sebz has joined #ocaml
<thelema> hcarty: odb bug should be fixed.
<thelema> right solution was to check for the dependency right before installing it, not anytime before
<thelema> also, we need to fix odn 0.0.7's deps in oasis-db
<thelema> or regen its setup.ml file with an older oasis so it doesn't fail on configure
waterfowl has quit [Read error: Connection reset by peer]
waterfowl has joined #ocaml
iago has quit [Remote host closed the connection]
ftrvxmtrx has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
bobry has quit [Quit: Connection closed for inactivity]
waterfowl has quit [Ping timeout: 240 seconds]
waterfowl has joined #ocaml
<samposm> I still don't understand why I need both foo.a and foo.cmxa :-(
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 255 seconds]
<thelema> samposm: .a has the actual library, .cmxa has ocaml metadata for the library (IIRC)
<thelema> needed for linking properly, cross-module inlining, etc.
<thelema> similarly, .o has the actual code, .cmx has ocaml metadata
<samposm> hmm, would that .a be callable from C, too, then?
<thelema> not easily... it assumes the ocaml runtime is available
<thelema> I wouldn't try
<samposm> ok
<samposm> "not easily" <- I like that :-)
brendan_ is now known as brendan
Anarchos has joined #ocaml
iago has joined #ocaml
waterfowl has quit [Ping timeout: 244 seconds]
<adrien> samposm: it's not very easy to do but it can definitely be done and some do
<adrien> also, looking at the file sizes is often quite telling: the .cmx* files aren't very big
<adrien> I'm trying to check how long an application is taking to start: is there a way to get the start time (the time of the exec() call on unices)
waterfowl has joined #ocaml
<thelema> adrien: some do? wow.
<thelema> start time until when?
sebz has quit [Quit: Computer has gone to sleep.]
<adrien> I basically do: let delta_time = let t_ref = ref (Unix.gettimeofday ()) in fun () -> let t_now = Unix.gettimeofday () in let delta = t_now -. !t_ref in t_ref := t_now; delta
<adrien> I'm not sure the code is a good explanation =)
<adrien> but the issue is that I can want to time the static initializations that happen because of libraries mostly
<adrien> (I think that lablgtk is slooooooooow)
waterfowl has quit [Ping timeout: 240 seconds]
fschwidom has quit [Remote host closed the connection]
sebz has joined #ocaml
<edwin> adrien: in C there is a function clock() that counts how many units of time have elapsed since the start of the program
<edwin> if you read that in your main function then it should give you an idea how long it took
<edwin> don't know if there's an OCaml binding for it
<edwin> ah I think its Sys.time ;)
<edwin> "Return the processor time, in seconds, used by the program since the beginning of execution."
<edwin> yep
<edwin> adrien: so just read Sys.time () in the main program
edwin has quit [Remote host closed the connection]
<adrien> that's CPU time and that doesn't take I/O into account
<adrien> also, I found something under /proc/$pid/stat on linux: start_time time the process started after system boot
<adrien> sounds great until you realize you don't know what "time" it is and how to get the "current" time in that format
<oriba_> adrien, if you only want to measure time from start to initialization, measure the time from a calling program, and exit right after the initialization. Then You measure start-up time and shutdown-time together, but without any actions.
<adrien> I'd like to measure several times unfortunately
<oriba_> do it in a loop
<oriba_> fork / exec
<oriba_> waitpit
<oriba_> waitpid
<adrien> I meant: several _different_ times: one for each "section" of my code
<oriba_> hmhh
<oriba_> so you want to measure time of certain GUI actions?
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
<adrien> not so much actions but steps in the program
<adrien> like I just found out that window#show () took 200ms
<oriba_> depends on the complexity of the window I think
<oriba_> and the load and speed of the computer....
<oriba_> how did you found out, if you are looking for measurement idea?
<adrien> oh
<adrien> perlmonks.org has a quite clever (imho) way: stat() on the /proc/$pid/stat file
<adrien> since it's created at program startup
pilki has joined #ocaml
<adrien> but I'm not sure it's preceise enough
<oriba_> ah, and you read that then at each new part of the program?
<oriba_> The linux kernel > 3.0 I think will have resolution in nano secs
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<adrien> it's time since epoch and that's something I can get with regular functions
<adrien> nano secs for stat? hmm
yezariae1y has joined #ocaml
<oriba_> nano secs for timing issues general I think... scheduling and such stuff
<oriba_> not have the details in mind
<oriba_> maybe tstas resolution can be confiugured
<oriba_> stats
<adrien> what I liked from my timings so far is:
<adrien> Options loading done: time+=0.000328; CPU+=0.000000
<adrien> (with Marshal)
<adrien> and at least firefox has/had issues with the time it takes to load options
yezariaely has quit [Ping timeout: 276 seconds]
<oriba_> FF is slow
<hcarty> thelema: Raising exceptions other than Invalid_argument from the Option module seems somewhat counter-intuitive (re: Batteries bug #198
<hcarty> )
raichoo has quit [Quit: leaving]
<thelema> hcarty: you think Option.get should raise Invalid_argument?
<hcarty> thelema: If odb is able to install oasis again, then ocamlbrew should be ready for the case you suggested (./ocamlbrew --all, which is what the curl ... | bash command effectively does)
<hcarty> thelema: Yes - I think it's somewhat reasonable to expect that Option.get is being used in an area where, logically, None should never be possible
<hcarty> thelema: If that's not the case then it's a logical error in the code - if None is a possibility then it should be checked for through pattern matching
<thelema> hmm... I guess that's fair enough. Except that to distinguish different Invalid_argument exceptions, one must match their strings - ugly. I guess if this performance fix is needed, get_exn can be used.
<thelema> hcarty: that's a very reasonable position, and one I didn't consider.
<thelema> hcarty: I'm trying ocamlbrew right now.
<thelema> hcarty: I like the | bash line
<hcarty> thelema: Ripped directly from perlbrew :-)
<thelema> hcarty: I still think your "run by hand" text is wrong.
<thelema> it's missing a chmod or a bash
<hcarty> Drat - you're right
<thelema> also, the comment on the |bash line could be written better - # set _base or _logfile first to customize
emmanuelux has quit [Remote host closed the connection]
<hcarty> thelema: Thanks - a few README tweaks pushed
<hcarty> And the odb fixes worked on my test ocamlbrew run
<hcarty> thelema: Thank you for getting those dependency fixes out so quickly
<thelema> confirmed. brew works here too
<thelema> hcarty: sorry for breaking things in master, with you depending on it.
oriba_ has quit [Quit: oriba_]
<thelema> hmm, at least it doesn't error out.... looking at the source, there seems to be no way for it to error out.
<hcarty> thelema: No worries re: odb breakage - both projects are fairly young. I'm not too concerned about ocamlbrew breaking until it has some sort of formal announcement.
<hcarty> thelema: At that point, perhaps we can discuss (possibly with gildor as well) how to keep both odb and ocamlbrew running smoothly together.
<thelema> wow, 91% of the log file is ocaml's compilation
Morphous_ has quit [Ping timeout: 252 seconds]
<hcarty> thelema: That's another shortcoming of ocamlbrew in its current state - if something breaks, you have to check the log to know, or know ahead of time that it prints "Done." when everything completes successfully.
<hcarty> And yes - OCaml has a long compilation log :-)
<thelema> also, odb will have to adjust - I noticed that odb used my existing ~/.odb, meaning that I now have some things in there compiled with my system ocamlc and some things compiled with the brewed ocamlc
<thelema> (luckily they're the same, but... )
emmanuelux has joined #ocaml
<thelema> why doesn't odb install inside ocamlbrew/version/lib/site-lib/?
<thelema> hmm : ${ODB_INSTALL_DIR="$OCAML_BASE"/odb}
<thelema> this is good, except odb isn't finding deps properly.
<hcarty> thelema: I'm off for a bit, possibly the night. Please leave any further comments/notes you have and I'll go through the logs when I'm back on.
<hcarty> thelema: Thank you again for testing!
<thelema> ok, cheers
sebz has quit [Quit: Computer has gone to sleep.]
Morphous_ has joined #ocaml
<adrien> mfp: I don't remember: does your "ld" for ocaml show load times? and can I replace all my uses of .cmxa with it + .cmxs files?
Plex has left #ocaml []
<mfp> adrien: it showed catalog build / dependency extraction / symbol resolution times, but could trivially be modified to show load times (just a few lines wrapping Dynlink.loadfile)
<mfp> as for replacing all .cmxa hmm it probably can?
emmanuelux has quit [Remote host closed the connection]
pilki has quit [Quit: This computer has gone to sleep]
<mfp> I tried it with ocsigen servers and had it load a dozen+ libs
<adrien> I remember using it but I don't remember exactly what I was using it for but I think I had quite a lot of libs too
<adrien> well, everything looks good so I'll probably try using it very soon (maybe tomorrow)
<adrien> thanks =)
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
ftrvxmtrx has quit [Ping timeout: 240 seconds]
orbitz has joined #ocaml
<orbitz> Hello, why does hashtbl have a syntax of ('a, 'b) Hashtbl.t not ('a * 'b) Hashtbl.t?
<thelema> orbitz: 'a * 'b is a pair, 'a, 'b is two separate parameters
<thelema> if it were the second, that would mean that hashtbl would only know about one type
<thelema> whereas hashtbl is parameterized by two types: key and value
ftrvxmtrx has joined #ocaml
<orbitz> is this Ocaml or ocamlp4?
<thelema> ocaml
<orbitz> Ohhhh
<orbitz> Ok I get it
<orbitz> brain fart
<samposm> is there a prettier way to tell ocamlmklib to inline when compiling libraries, than: ocamlmklib -ocamlopt "ocamlopt -inline 10" ?
sebz has joined #ocaml
<thelema> samposm: ocamlopt normally inlines a reasonable amount
<thelema> samposm: so no work is nexessary
<thelema> *necessary
oc13 has quit [Ping timeout: 244 seconds]
<samposm> no it does not seem to, when I put -ocamlopt "ocamlopt inline 2", the code runs in 2x speed
<thelema> samposm: -inline 1 is default, so apparently your code benefits from inlining more than expected
<thelema> and inline 0 disables inlining (except for functions whose body is smaller than the call site)
<thelema> often, agressive inlining blows instruction caches and decreases performance
lamawithonel has joined #ocaml
<samposm> I like my double speed :-)
lamawithonel__ has joined #ocaml
lamawithonel has quit [Read error: Operation timed out]
lamawithonel__ has quit [Remote host closed the connection]