flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
thomasga has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
thomasga has quit [Quit: Leaving.]
groovy2shoes has quit [Quit: Computer has gone to sleep]
emmanuelux has joined #ocaml
Neros has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
Neros has quit [Remote host closed the connection]
Neros has joined #ocaml
q66 has quit [Remote host closed the connection]
emmanuelux has quit [Read error: Connection reset by peer]
ollehar has quit [Ping timeout: 240 seconds]
watermind has quit [Read error: Connection reset by peer]
watermind has joined #ocaml
ollehar has joined #ocaml
pkrnj has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
watermind has quit [Ping timeout: 255 seconds]
watermind has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
tane has quit [Remote host closed the connection]
yacks has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
wmeyer` has quit [Remote host closed the connection]
gnuvince has quit [Remote host closed the connection]
darkf_ has joined #ocaml
weie_ has joined #ocaml
mattrepl_ has joined #ocaml
gnuvince has joined #ocaml
jonafan_ has joined #ocaml
alxbl_ has joined #ocaml
alxbl has quit [Disconnected by services]
alxbl_ is now known as alxbl
darkf has quit [*.net *.split]
mattrepl has quit [*.net *.split]
weie has quit [*.net *.split]
thizanne has quit [*.net *.split]
jonafan has quit [*.net *.split]
mattrepl_ is now known as mattrepl
thizanne has joined #ocaml
pkrnj has joined #ocaml
watermind has quit [Ping timeout: 264 seconds]
ontologiae has quit [Ping timeout: 240 seconds]
derek_c has joined #ocaml
darkf_ is now known as darkf
derek_c has quit [Ping timeout: 245 seconds]
derek_c has joined #ocaml
gnuvince has quit [Remote host closed the connection]
gnuvince has joined #ocaml
gnuvince has quit [Remote host closed the connection]
wmeyer has joined #ocaml
ggole has joined #ocaml
leoncamel1 has quit [Quit: WeeChat 0.3.9.2]
derek_c has quit [Read error: Operation timed out]
Kakadu has joined #ocaml
<wmeyer> morning
<Kakadu> yeah, morning
<wmeyer> Kakadu: how is QML?
<Kakadu> wmeyer: QML itself is OK, I have a crash in caml_oldify_local_roots () bby some reason...
<wmeyer> is it autogenerated?
<Kakadu> C++ code? most part of it, yes
<wmeyer> github?
<wmeyer> do you have an autogened snippet?
<Kakadu> T
<Kakadu> it is in Git
<Kakadu> AbstractModel*, Controller*, DataItem*
<Kakadu> this files
<Kakadu> i.e. these*
<wmeyer> you don't use camlreturn
<wmeyer> you *have* to
<Kakadu> where?
<wmeyer> everywhere
<wmeyer> line 19 for instance
<Kakadu> AbstractModel::parent ?
<wmeyer> you allocate local roots using camllocal but you don't use camlretur
<wmeyer> line 10: you allocate out of the heap and then store values inside, instead of allocating a managed block
<wmeyer> Store_field makes sense with OCaml heap allocated blocks
<wmeyer> actually line 27
<Kakadu> mmm
<wmeyer> if you fix these I will have another look
<wmeyer> (if it still crashes)
<Kakadu> but why this code is OK? http://paste.in.ua/8154/
<wmeyer> because it has no local OCaml values
<Kakadu> So, If I have CAMLlocal I *should* use CAMLparam0+CAMLreturn?
<wmeyer> yes
<wmeyer> *must*
<wmeyer> but the bigger problem is your allocation on the C++ heap and using Store_field
<wmeyer> it's best to understand how the gc works at first
<wmeyer> and then everything will become crystal clear
<wmeyer> no, this is fine, as you allocate array of blocks
<wmeyer> so try to fix the camlreturn problem
<Kakadu> okay
<wmeyer> apart from that there are obvious memory leaks, you should try to use caml heap everywhere where it's feasible, so you get the gc for free
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
derek_c has joined #ocaml
<wmeyer> is it still crashing?
<wmeyer> this is different crash
<Kakadu> yep
<wmeyer> well line 28
<wmeyer> why you are allocating like this: value *args = new value[4];
<wmeyer> instead of allocating Caml block?
<wmeyer> as I said, you can't do this
<Kakadu> and what is correct code?
derek_c has quit [Quit: Lost terminal]
<wmeyer> In general Kakadu treat Caml heap as something special, understand the principles of GC
<wmeyer> I'd just allocate with caml_alloc instead of new
<ggole> Kakadu: the GC needs to be able to reach all caml values to relocate correctly
<ggole> It doesn't know about new
<wmeyer> ggole: perfect explanation!
<wmeyer> in general you can always store C++ pointer to memory inside caml heap, but never other way round
<ggole> A live C++ pointer
<ggole> Deallocated ones can be reallocated as part of the caml heap, confusing the GC and leading to suffering.
<wmeyer> not nesercairly, just something that resemebles address and it's outside the caml heap
<ggole> Oh yeah, you can point at statically allocated stuff just fine
<wmeyer> having a danling pointer is perfectly fine, if you know what you do
<ggole> If you are in control of the deallocation?
<wmeyer> yes
<ggole> Yeah, makes sense
<wmeyer> gc will not try to enter these pointers
<Kakadu> okay. I should write `value args=caml_alloc(N,..);` and use it like `caml_callbackN(_meth,N,&args)`?
nimred has joined #ocaml
nimred has quit [Changing host]
nimred has joined #ocaml
<ggole> No
<ggole> Because then args can't be seen by the GC
<Kakadu> sorry
<ggole> Anytime a caml value is not visible to the caml runtime is a bug
<wmeyer> you should not dereference values with ampersand
<Kakadu> CAMLlocalN(args,...) and without `value`
<ggole> Kakadu: there's a page in the ocaml docs about interfacing with C that explains the issues
<Kakadu> ggole: I know.
<wmeyer> I think getting that right takes time Kakadu. Please read about gc
<wmeyer> really understanding the FFI issues is not a trivial problem. Either you learn by heart the rules in the pointed out by ggole document or just know what not to do.
Nahra has joined #ocaml
<Kakadu> wmeyer: OCaml GC or general GC?
<ggole> Most GC interfaces have similar rules
<wmeyer> read about generational garbage collectors, it's always better to know more
<wmeyer> it really helps!
<wmeyer> ggole is right that most of these issues have common denominator, however, most of the that's called dynamic languages avoid most of these using reference counted objects
<wmeyer> surely OCaml has far better runtime, therefore different set of rules apply
* Kakadu thinks that he has knowledge but he can't appy them
<Kakadu> apply*
<wmeyer> I think the most important facts
<wmeyer> - gc needs to reach every block
<wmeyer> - the gc can move values during allocation and get rid of them
<wmeyer> - the C stack frame may contain values
<wmeyer> - you can store C pointers inside blocks
Yoric has joined #ocaml
<wmeyer> - everything is either int or pointer to block
<wmeyer> that's pretty much it
<ggole> Kakadu: looking at your code, you also need to use the caml accessors instead of C's []
<ggole> This has a nice example explaining how to allocate and populate a block http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html#toc146
ttamttam has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
Pantoufle has joined #ocaml
ttamttam has quit [Remote host closed the connection]
romerun has joined #ocaml
<romerun> yo, anyone using Typerex in emacs ? or what other ides do you recommend
mattrepl has quit [Quit: mattrepl]
<ggole> I have it installed
<ggole> Don't really use the features much though
<romerun> i installed it via opam, but I only see "caml-mode" and "tuareg-mode" wondering if I should see "typerex-mode" or it failed to install
<ggole> I installed and built manually, which was fairly painless
<Kakadu> romerun: Have you updated your emacs config?
<romerun> version 1 or the latest version (1.99 -beta ) ?
<wmeyer> you have to add the /home/danmey/.opam/4.00.1/share/typerex to load-path in .emacs
<wmeyer> sorry my local guess :-)
<ggole> 1.0.1
<romerun> I have this: (with-temp-buffer (insert (shell-command-to-string "ocp-edit-mode emacs -load-global-config")) (eval-buffer)) in .emacs
<ggole> I should probably upgrade some time
mikurubeam has quit [Ping timeout: 255 seconds]
<ggole> Hmm... I'm not sure what, if anything, opam expects you to do to get typerex running in emacs
<ggole> The INSTALL gives you a bunch of boilerplate elisp to stick into your init files
<wmeyer> well, Emacs does not know about Opam
<ggole> Which worked for me
<wmeyer> you have to add smth like: (setq load-path (cons "/home/foo/.opam/4.00.1/share/typerex" load-path))
<wmeyer>
<romerun> I'm trying that load path..
<wmeyer> (i don't know whatever the path is 100% correct, you have to find it yourself)
<ggole> There's a bunch of autoload and mode stuff too
<ggole> (add-to-list 'auto-mode-alist '("\\.ml[iylp]?" . typerex-mode))
<ggole> I would peruse INSTALL.
<wmeyer> ggole: that's only when you want typerex to be the default mode loaded after visiting the ml file
<ggole> Yes... isn't that what he wants?
<wmeyer> we should somewhat have better way of installing Emacs modes in OPAM
<wmeyer> might want or not, sometimes M-x typerex-mode is enough to try
<ggole> Fair enough.
<ggole> emacs has a package manager of its own now
<ggole> Maybe that would be the least painful path.
<romerun> I still don't see typerex-mode after adding (setq load-path (cons "/Users/kem/.opam/system/share/typerex" load-path)) to .emacs
<wmeyer> sure, M-x list-packages
<wmeyer> you have to say (require 'typerex-mode)
<wmeyer> or typerex, it's best to follow the README in your .opam install directory
<romerun> am I supposed to see typerex.el in ~/.opam/system/share/typerex/ocp-edit-mode/emacs/
<romerun> i'll follow the readme
Neros has quit [Ping timeout: 245 seconds]
mikurubeam has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
mikurubeam has quit [Quit: +1 (Yes). -1 (No). i (What I have been trying to tell you all along).]
mikurubeam has joined #ocaml
mikurubeam has quit [Client Quit]
mikurubeam has joined #ocaml
romerun has left #ocaml []
answer_42 has joined #ocaml
Uvs has joined #ocaml
yacks has quit [Ping timeout: 252 seconds]
Neros has joined #ocaml
Fnar has quit [Quit: Client exiting]
ttamttam has joined #ocaml
ttamttam has quit [Quit: ttamttam]
yacks has joined #ocaml
yacks has quit [Max SendQ exceeded]
ollehar has joined #ocaml
Neros has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
ollehar1 has joined #ocaml
Yoric has joined #ocaml
<ollehar1> using opam to switch to 4.00.1, ocamlopt is still 3.12?
ulfdoz has joined #ocaml
<Kakadu> https://github.com/Kakadu/lablqt/blob/qml-dev/qml/lib/test/AbstractModel_c.cpp#L23 I hope this code should be OK when GC compactions are disabled.
<Kakadu> ollehar1: what do u mean?
q66 has joined #ocaml
<ollehar> I think I've misunderstod the user of opam switch... 4.00.1 in on terminal, 3.12.1 in another
eikke has joined #ocaml
<orbitz> ollehar: did the other terminal do the config eval?
<ollehar> nope
<orbitz> well there you go
contempt has quit [Remote host closed the connection]
<wmeyer> briefly, looks good Kakadu
<wmeyer> orbitz: hello
<orbitz> wmeyer: hai
contempt has joined #ocaml
<ollehar> orbitz: can I upgrade the compiler permanently?
<ollehar> not using opam
<Kakadu> now I'm thinking why everything crashes. Possible reason is that OCaml value was moved by GC but compactions are disabled and that should not been happened
<orbitz> ollehar: sure, install a new compiler not through opam
<ggole> Kakadu: value args[4] = { _camlobj,_cca0,_cca1,_cca2 }; <- broken. Use CAMLlocalN.
wmeyer has quit [Remote host closed the connection]
<Kakadu> ggole: and what should I write instead of `caml_callbackN(_meth, 4, args);` than?
<ggole> That bit is fine, I think
eikke has quit [Ping timeout: 264 seconds]
<Kakadu> Than I don't understand. Do u want `args` to be an OCaml array?
<ggole> No. CAMLlocalN informs the GC about a C array of N values.
<ggole> Which is what you need to do.
<Kakadu> aaaah
<Kakadu> I was thought that CAMLlocalN is pattern for CAMLlocal1..CAMLloca5 :)
<ggole> Nope.
<ggole> You really should read the page on interfacing with C again, it contains all the details.
<Kakadu> #define CAMLlocalN(x, size) \
<Kakadu> value x [(size)] = { 0, /* 0, 0, ... */ }; \
<ggole> Even if it's boring.
<Kakadu> CAMLxparamN (x, (size))
mikurubeam has quit [Read error: Connection reset by peer]
<Kakadu> Okay, It is not exactly what I written
<ggole> Excuse, me, my pasta is almost done. :)
* ggole back in a bit
wmeyer has joined #ocaml
<ollehar> "error loading shared library: dllpcre_stubs.so" no such file
<ollehar> how do I check where it's looking?
<ollehar> the compiler, I mean
<orbitz> ocamlc might have an option to print search path
<wmeyer> CAML_LD_LIBRARY_PATH is the interesting variable
<orbitz> otherwise strace can tell you
<orbitz> also: is pcre isntalled via opam? if so you have to do the eval
<wmeyer> you can do: ls -l ~/.opam/**/dllpcre_stubs.so
<wmeyer> sometimes I had such problems (not pointing to the location for the bytecode runtime shared libs)
<wmeyer> I don't remember if that was misconfiguration or something else
<Kakadu> for me it is in /home/kakadu/.opam/4.00.1/lib/stublibs/dllpcre_stubs.so
mikurubeam has joined #ocaml
ttamttam has joined #ocaml
ollehar1 has quit [Ping timeout: 252 seconds]
ollehar has quit [Quit: ollehar]
eikke has joined #ocaml
ollehar has joined #ocaml
ttamttam has quit [Quit: ttamttam]
contempt has quit [Remote host closed the connection]
contempt has joined #ocaml
Neros has joined #ocaml
<ollehar> can I add dirs to CAML_LD_LIBRARY_PATH permanently from command line?
<ollehar> nm, google found it
<wmeyer> sure you can, it works the same as the similar gcc toolchain variables
* wmeyer goin' to put fish & chips to the oven
<adrien> or How to know someone lives in England
<wmeyer> s/lives/dying/
<ollehar> gah, now ocamlfind won't find my old libs
<ollehar> updated ocamlfind with opam
<wmeyer> adrien: morning
<wmeyer> ollehar: better just reset your environment, and do it from scratch
<adrien> wmeyer: :D
<Kakadu> So, If I can't make an OCaml value to be stored always in the same location, I should generated a name for the value and allow access using Callback.register () ?
<Kakadu> s/generated/generate/
<ollehar> "interface mismatch on Int32" for package netsys
<ollehar> could some packages be incompatible with 4.00.1?
<Kakadu> ollehar: compilation error?
<adrien> yes
<adrien> ollehar: do you have the latest version?
<ollehar> net sure, will check
<ollehar> *not
Anarchos has joined #ocaml
<companion_cube> is there some simple way to download web pages and parse their urls?
<companion_cube> (maybe invoking an external tool rather than using ocamlnet...)
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
tane has joined #ocaml
<Kakadu> wget?
<companion_cube> ok, but then I'd like to extract the set of urls of the page
<companion_cube> i'm looking into python...
<Kakadu> You want to parse downloaded text?
<companion_cube> well, sure
<companion_cube> only to get the href in them, though
<adrien> grep for something that looks like an URL
<adrien> then parse against the RFC? there are a few libs for that
<companion_cube> grep sounds like the simplest thing, good idea
<companion_cube> I just want a proof of concept :)
<adrien> 99.9% (like all stats) of URIs will be simple to find and you probably don't care that much about deliberately obfuscated URIs anyway
<companion_cube> grep -o 'http://[^ "]*' looks good enough
<adrien> /o\
<companion_cube> ;)
<bernardofpc> I don't know how many URLs are now JS-generated
<adrien> <a href=http://foo.bar>baaaaaah</a>
<bernardofpc> (like all adds)
<companion_cube> adrien: you're supposed to put "", I think
<adrien> companion_cube: supposed? we're talking about HTML ;-)
<companion_cube> :)
<companion_cube> rhaaa, there is no simple way to split a string into lines... -_-
<adrien> do it on <[^]\+>
<adrien> or >
<companion_cube> wat
<companion_cube> even in batteries, there is not any "lines : string -> string list" oO
<wmeyer> companion_cube: I found ocamlnet and pcre a good way of doing such URL introspection
Yoric1 has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
<adrien> companion_cube: Str has it
<wmeyer> companion_cube: let lines = String.nsplit str "\n" in
<wmeyer>
<wmeyer> (Batteries)
<companion_cube> but Str is not thread safe
<companion_cube> wmeyer: oh, thanks
darkf has quit [Quit: Leaving]
<companion_cube> hmm, too bad Batteries' modules export "print" functions, but not "fprintf"
leoncamel has joined #ocaml
ulfdoz has quit [Ping timeout: 255 seconds]
<ollehar> why does ocamlfind keep installing in /usr/lib/ocaml/site-lib instead of .opam
<ollehar> ?
<ollehar> findlib.conf is set to opam
Neros has quit [Ping timeout: 264 seconds]
ulfdoz has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<ollehar> nm, solved
leoncamel has quit [Ping timeout: 245 seconds]
ontologiae has joined #ocaml
<Kakadu> cool, my app have stopped crashing
ollehar1 has joined #ocaml
<Kakadu> pippijn: do u have any ideas how ocamlbrowser should look like?
<Kakadu> i.e. You have mentioned you want new ocamlbrowser, did u write down what u expect?
pango is now known as pangoafk
tane has quit [Quit: Verlassend]
groovy2shoes has joined #ocaml
ollehar1 has quit [Ping timeout: 245 seconds]
groovy2shoes has quit [Quit: Computer has gone to sleep]
groovy2shoes has joined #ocaml
gnuvince has joined #ocaml
ttamttam has joined #ocaml
groovy2shoes has quit [Ping timeout: 260 seconds]
ttamttam has quit [Remote host closed the connection]
ontologiae has quit [Ping timeout: 255 seconds]
pangoafk is now known as pango
ollehar1 has joined #ocaml
awm22 has quit [Quit: Leaving.]
q[mrw] has joined #ocaml
leoncamel has joined #ocaml
smondet has joined #ocaml
oriba has joined #ocaml
Uvs has quit [Ping timeout: 252 seconds]
icarot has joined #ocaml
<ollehar1> Error: This expression has type ('a, 'b) nat
<ollehar1> but an expression was expected of type ('a, 'b s) nat
<ollehar1> The type variable 'b occurs inside 'b s
<ollehar1> Got that error
<orbitz> ok
<ollehar1> any idea how to define a plus for type level church numerals?
icarot has quit [Remote host closed the connection]
<oriba> Eat one vlue down, while you add the other up
Uvs has joined #ocaml
icarot has joined #ocaml
icarot has quit [Client Quit]
oriba has quit [Quit: oriba]
leoncamel has quit [Ping timeout: 246 seconds]
yacks has joined #ocaml
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 246 seconds]
<ollehar1> oriba: not so easy to do at type level :P :P
awm22 has joined #ocaml
q[mrw] has quit [Ping timeout: 255 seconds]
Uvs has quit [Ping timeout: 246 seconds]
Uvs has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
iZsh has quit [Quit: Coyote finally caught me]
pib1979 has joined #ocaml
ollehar1 has quit [Ping timeout: 264 seconds]
julm has left #ocaml []
ulfdoz has quit [Ping timeout: 260 seconds]
ollehar has joined #ocaml
ontologiae has joined #ocaml
ttamttam has joined #ocaml
def-lkb has quit [Quit: leaving]
mikurubeam has quit [Quit: +1 (Yes). -1 (No). i (What I have been trying to tell you all along).]
def-lkb has joined #ocaml
mikurubeam has joined #ocaml
watermind has joined #ocaml
eikke has quit [Ping timeout: 245 seconds]
ggole_ has quit []
ollehar1 has joined #ocaml
ewanas has joined #ocaml
<ollehar> what is this?
<ollehar> Assertion failed, file "camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml", line 284, char 8
<ollehar> trying to make polymorphic recursive functions
Ptival has quit [Remote host closed the connection]
sw2wolf has joined #ocaml
pkrnj has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
Ptival has joined #ocaml
mikurubeam has quit [Quit: +1 (Yes). -1 (No). i (What I have been trying to tell you all along).]
groovy2shoes has joined #ocaml
Kakadu has quit []
ewanas has quit [Quit: ChatZilla 0.9.90 [SeaMonkey 2.16.2/20130317033554]]
cdidd has quit [Read error: Connection reset by peer]
mikurubeam has joined #ocaml
Neros has joined #ocaml
ttamttam has left #ocaml []
answer_42 has quit [Quit: WeeChat 0.4.0]
Neros has quit [Ping timeout: 245 seconds]
Yoric1 has quit [Ping timeout: 264 seconds]
ulfdoz has joined #ocaml
ollehar has quit [Ping timeout: 255 seconds]
Neros has joined #ocaml
darkf has joined #ocaml
Uvs has quit [Quit: Uvs]
sw2wolf has left #ocaml []
BiDOrD has quit [Quit: No Ping reply in 180 seconds.]
iZsh has joined #ocaml
BiDOrD has joined #ocaml
ousia has joined #ocaml
troydm has quit [Ping timeout: 256 seconds]
BlackBook has joined #ocaml
<BlackBook> Compiling OCaml (ocaml-4.00.1) as it's a dependency for some other software I want to play with, I get a compilation error: http://pastebin.com/unnCAeSs
<BlackBook> FYI and all that.
ollehar1 has quit [Ping timeout: 245 seconds]
awm22 has quit [Read error: Connection reset by peer]
awm22 has joined #ocaml
awm221 has joined #ocaml
awm22 has quit [Read error: Connection reset by peer]
groovy2shoes has quit [Quit: Computer has gone to sleep]