<Camarade_Tux>
I have a thread that dies with an uncaught exception, is it possible to print a backtrace for it? I can't really access it since the thread is created by lablgtk2
<flux>
is it your function that's running in the thread?
<flux>
you can have something like: let show_backtrace f = try f () with exn -> Printexc.print_stacktrace () (* or something *); rais exn
<flux>
but that's the limit of what you can do. so if you can't insert that function anywhere, you're out of luck, AFAIK
<Camarade_Tux>
seems I'm stuck then, I'd have to edit lablgtk's code in order to show the trace
<dark>
hmmm
<dark>
doesn't ocaml have a debugger?
<flux>
it does have ocamldebug
<flux>
I'm not sure if gdb works, I think there was some discussion recently about providing it better debug information
<dark>
the debugger cant print a stack?
<dark>
.-.
<flux>
I haven't really used it. I don't know if you can stop it on thrown exceptions.
<flux>
nor if it supports multiple threads
itewsh has joined #ocaml
<Camarade_Tux>
(bah, I hate wifi)
<Camarade_Tux>
I can't really use ocamldebug: I'm running a program that starts another program which is the one with the error
<flux>
don't hate is just because yours sucks ;)
<flux>
s/is/it/
<Camarade_Tux>
hehe :P
<Camarade_Tux>
partly because my wifi card sometimes starts sleeping and dmesg gives me "MAC is in deep sleep" messages ><
* Camarade_Tux
hugs his cat5
<Camarade_Tux>
but I found something more "expected" for my bug: before the problematic function seemed to be (fun _ -> true) but it is actually in f [| `CAML (Obj.repr t |] (with f that I don't know yet) which makes much more sense
<Camarade_Tux>
and the exception is raised by the failwith() at the end of this C code: http://vpaste.net/zot39?
mfp has joined #ocaml
<Camarade_Tux>
wifi failed again, now on cat5, at least, it works
<flux>
camarade_tux, can you patch the code to do abort() so it would produce a core dump? maybe gdb would tell backtrace on that?
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<Camarade_Tux>
after reading the source, it seems I can't do what I wanted: I wanted to forward a signal (a C struct) to another widget but I'll have to forward it base value by base value (three ints rather than a struct with three ints)
<Camarade_Tux>
lablgtk2 simple does not offer support for what I wanted
Yoric has joined #ocaml
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
Pimm has joined #ocaml
Yoric has quit []
maskd has joined #ocaml
<ksson>
if a thread dies because of an uncaught exception, does the whole program die?
<flux>
no
dark has quit [Read error: 104 (Connection reset by peer)]
<Camarade_Tux>
you get something like: "In callback for signal key_press_event, uncaught exception: Failure("GObject.Value.set : argument type mismatch")"
<Camarade_Tux>
btw, if I have a value that is a pointer to a C struct allocated by C code, can I marshall it, unmarshal it somewhere else in the main program and use it safely?
<flux>
wouldn't you need to write your own marshalling code?
<flux>
hmm, or not :)
<Camarade_Tux>
if I'm only marshalling the pointer to the struct it's ok but I think I'll have problems since the struct may be freed while I'm using it
<mrvn>
palomer: The FAQ from yesterday said that it it restricts when it can't proove that there will be no exception or allocation. That probably covers every function call.
<palomer>
this example isn't a function call
<palomer>
I understand that function calls cannot be generalized
<mrvn>
palomer: "counter ()" is a function call
<palomer>
baz is generalized
<palomer>
but foo isn't
<mrvn>
because between foo and baz there is counter ()
<palomer>
im assigning foo to something clearly polymorphic
<palomer>
but foo isn't polymorphic
<palomer>
that seems a little strange
<mrvn>
yes
<palomer>
there is no intuitive reason for this
<palomer>
it's a consequence of how the ocaml type system works
<mrvn>
It seems that "let x = y" will always un-generalize y and then see if it can generalize it again.
<mrvn>
between the let baz and returning baz the type of bar changes.
<palomer>
it doesn't really change, since it was monomorphic from the start
<palomer>
and baz is also monomorphic from the start
<palomer>
in my example baz is polymorphic
<mrvn>
val baz : 'a -> '_b list = <fun>
<palomer>
right
<mrvn>
half polymorphic :)
<palomer>
ok, I meant not fully polymorphic:P
<mrvn>
My point was that between the let baz and let foo other expressions cn alter things.
<mrvn>
But you are right. not a good example as bar is monomorphic and becomes int.
<palomer>
my example is perfectly safe
<mrvn>
yeah. we had a few of those yesterday too.
<palomer>
and it would work if ocaml didn't reify before regeneralizing
<mrvn>
There is probably some ugly example where it needs to
<palomer>
I dare you to find one
<palomer>
I'm 100% sure that "ungeneralizing" before generalizing is pointless
<mrvn>
All I can think of are already monomorphic like the ref []
<palomer>
this kind of stuff is perfectly safe
<flux>
just write it in Coq, extract the code, and you can trust its Obj.magic invocations :)
<palomer>
mrvn, if we put everything on the toplevel it would work
<mrvn>
You might have to go back to 1997 when they created the value restriction and find out why they did it.
<palomer>
I know why they did it!
<palomer>
the problem isn't the value restriction, the problem is ocaml being lazy
<palomer>
they instantiate all the variables in baz (since it is an expression) before generalizing foo, which is pointless
<mrvn>
The bad thing is that writing "let foo x = ..." means that counter is called on every invokation. Makes it slower and if counter has sideeffects it ruins the semantic.
<mrvn>
and putting "let bar =" at the top level pollutes the namespace.
<palomer>
right, I'm looking for a specific semantics where "foo the function" contains a unique identifier
<palomer>
right, polluting the namespace is bad
<flux>
another alternative: write it in C
<mrvn>
palomer: best I can think of is to use something like let foo__id = counter () let foo = ...
<mrvn>
Pepe_: i.e. make a rule that identifiers with __ are for camlp4 only
<mrvn>
or rewrite the type inference in ocaml :)
<mrvn>
s/pepe_/palomer/
<palomer>
bah, I'll just pollute the namespace
<palomer>
there's really no way I can win here
<mrvn>
flux: he is generating the code with camlp4. No inline C/asm in ocaml :(
<julm>
mrvn: yep identifier :P
joewilliams has quit [Remote closed the connection]
yziquel has joined #ocaml
maskd- has joined #ocaml
maskd has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has joined #ocaml
avsm has joined #ocaml
maskd- is now known as maskd
Narrenschiff has quit []
jeddhaberstro has quit [Client Quit]
_zack has quit ["Leaving."]
jeddhaberstro has joined #ocaml
ksson has joined #ocaml
Pimm has quit [Read error: 104 (Connection reset by peer)]
<thelema>
palomer: # let foo = let bar = counter () in fun x -> bar;;
<thelema>
value foo : '_a -> int = <fun>
Amorphous has quit [Read error: 110 (Connection timed out)]
ksson has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
struktured has joined #ocaml
Yoric has joined #ocaml
_unK has joined #ocaml
Yoric has quit []
avsm has quit ["Leaving."]
CcSsNET has joined #ocaml
CcSsNET has quit [Remote closed the connection]
CcSsNET has joined #ocaml
BigJ has quit ["Leaving"]
<palomer>
let foo = let bar = counter () in let baz = fun x -> x in baz <--should definitely be polymorphic
cloudhea has joined #ocaml
cloudhead has quit [Read error: 60 (Operation timed out)]
Pimm has joined #ocaml
quelqun_dautre has quit [Read error: 60 (Operation timed out)]
quelqun_dautre has joined #ocaml
Yoric has joined #ocaml
<palomer>
Yoric, glad to see you're enjoying your vacation with us
<Camarade_Tux>
wow, scribd seems to have lots of papers :o
<Camarade_Tux>
in particular, it seems to have paper on R-Trees
<mrvn>
Was ist ein R-Tree?
<mrvn>
hmm, some form of octree it seems.
<Camarade_Tux>
Wenn Sie ein 2D Datei...
<Camarade_Tux>
giving up on german ;p
<Camarade_Tux>
but yeah, basically, it's for efficient storage of 2D data
<mrvn>
stupid site only lets you download the pdf when you sign up and displaying it needs flash.
<Camarade_Tux>
yeah, it's quite annoying for that and sometimes there are restrictions on downloads but the database is pretty good
<mrvn>
maybe someday someone will write a good free flash plugin.
<Camarade_Tux>
you mean, something like gnash?
<mrvn>
without the bugs
<mrvn>
or missing features
<Camarade_Tux>
well, I'm pretty optimistic: gnash has improved and flash too
<mrvn>
there is hope
<Camarade_Tux>
it leaks like hell but it's not as bad as it used to be (I have it disabled unless when I really need it)
<Camarade_Tux>
oh, btw, scribd's flash is pretty inefficient: it can eat hundreds of MB of memory for long PDF files :-)
<Camarade_Tux>
(and if anyone knows of a pdf reader in flash, I'm taking it: my "music" player runs flash)
Yoric_ has joined #ocaml
tmaeda is now known as tmaedaZ
aklt has joined #ocaml
<Leonidas>
Hmm, I just installed camlzip, how can I open it in the toplevel?
<Leonidas>
ocamlmktop -I $(ocamlfind query zip)
<Leonidas>
did not produce a toplevel that knows Zlib
<flux>
unfortunately you cannot (easily) add directories into search path with ocamlmktop
yakischloba has joined #ocaml
<flux>
so basically you have an init file that you load to your new shiny toplevel
<flux>
alternative solutions: maybe it's possible to write a module that makes use of the Toploop module to add the directory
<Camarade_Tux>
Leonidas: and why not use 'ocamlfind ocamlmktop'?
<Leonidas>
flux: ocaml -I $(ocamlfind query zip) worked
<flux>
leonidas, it does, yes..
<flux>
but, if there's a way to make a toplevel that incorporates -I -switches, I don't know it
<flux>
I'd very much like to, though :)
<flux>
(hey, maybe someone can research that Toploop-approach and report back? ..)
<Leonidas>
Camarade_Tux: because that ocamltop does not know Zlib
<flux>
leonidas, the -I only covers the need of ocamlmktop needing to find the files
Yoric__ has joined #ocaml
* Leonidas
tries to write a deflate decompressor in ocaml but is surprised by what zlib spits out.
<flux>
leonidas, ..hmh? but you are just using ocamlfind to find zip?
<Leonidas>
flux: yep, and that has a binding to Zlib.
<Leonidas>
i tried the zlib binding in python and the results are... interesting.
<Leonidas>
''.join(bin(ord(c))[2:].zfill(8) for c in zlib.compress('Blah blah blah blah blah!'))
<flux>
how about: zlib.uncompress (or whatever)(zlib.compress("blab") ?
<orbitz>
Hrm, I just learned of Nitrogeon in Erlang, reminds me of OPA
<Leonidas>
flux: my code results in a '01111000100111000111001111001010010010011100110001010000010010001100001000100100000101000000000101101111000110010000100001110101'
Yoric has quit [Read error: 110 (Connection timed out)]
Yoric__ is now known as Yoric
<Leonidas>
flux: first 3 bits = 011, so 0 = not last block, and 11 = reserved
<Leonidas>
and this puzzles me.
<orbitz>
hey yoric
lagenar has joined #ocaml
<palomer>
Leonidas, you can remove the -I with ocamlfind query -i-format
<Leonidas>
oh, indeed. nice.
_unK has quit [Remote closed the connection]
Pepe___ has joined #ocaml
Yoric_ has quit [Read error: 113 (No route to host)]
Pepe_ has quit [Read error: 113 (No route to host)]
Pepe___ is now known as Pepe_
thieusoai has quit ["leaving"]
cloudhea has quit [Client Quit]
cloudhead has joined #ocaml
wormphlegm has joined #ocaml
wormphlegm has quit [Client Quit]
ccasin has joined #ocaml
Tomsik has quit [Read error: 60 (Operation timed out)]
lagenar has left #ocaml []
cloudhead has quit [Connection timed out]
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
Yoric has quit []
<yziquel>
I run a binding in bytecode (there's no problem in native code). This loads a .so library, which in turns loads other .so libraries. It seems to me that I've got symbols in the BSS (uninitialised data section) that gets loaded, but in a memory zone that is not cleared to 0.
<yziquel>
and the .so library's code relies on BSS --> uninitialised to 0.
<yziquel>
does ocaml set BSS to 0 when dynamically loading .so from bytecode?
Amorphous has quit [farmer.freenode.net irc.freenode.net]
flux has quit [farmer.freenode.net irc.freenode.net]
sgnb` has quit [farmer.freenode.net irc.freenode.net]
noj has quit [farmer.freenode.net irc.freenode.net]
ttamttam has quit ["Leaving."]
Amorphous has joined #ocaml
flux has joined #ocaml
sgnb` has joined #ocaml
noj has joined #ocaml
<mrvn>
yziquel: BSS segments get allocated and the dynamic linker should zero them
<yziquel>
mrvn: followed machine code instruction step by step, and i get box[i] != NULL statement which evaluates to true, with box uninitialised.
<yziquel>
mrvn: so there's obviously an issue somewhere.