<hcube>
i've a gc related question: can i hold an ocaml value in C?
Amorphous has joined #ocaml
hcube has quit [Ping timeout: 240 seconds]
grettke has joined #ocaml
ldunn has joined #ocaml
ldunn has quit [Changing host]
ldunn has joined #ocaml
Elench has quit [Ping timeout: 255 seconds]
grettke has quit []
ldunn has quit [Remote host closed the connection]
Modius has joined #ocaml
gnuvince_ has quit [Ping timeout: 276 seconds]
gnuvince has joined #ocaml
gnuvince has quit [Ping timeout: 265 seconds]
Modius has quit [Quit: I'm big in Japan]
gnuvince_ has joined #ocaml
hcube has joined #ocaml
ygrek_ has joined #ocaml
Snark has joined #ocaml
dark has quit [Ping timeout: 272 seconds]
dark has joined #ocaml
<kerneis>
hcube: you can add a value in the "roots" so that the GC does not move/collect it
<kerneis>
(nor any value it depends on)
<kerneis>
but I never did that so can't remember the name of the function to call from C code
<julm>
register_global_root()
Dynetrekk has joined #ocaml
<Dynetrekk>
hi, I am trying to compile unison from source, and I get this error both when installing from macports or compiling from source (2.27.57): http://paste.pocoo.org/show/291115/
<ygrek_>
Dynetrekk, either upgrade unison or downgrade ocaml (to 3.11.x)
<Dynetrekk>
ygrek_: oooh... that's bad news. the ocaml from macports is 3.12. has it broken unison? this breaks both unison 2.27 and 2.32, which means there's not much to choose from
ztfw has joined #ocaml
<Dynetrekk>
what is the difference between the ocaml versions? 3.11 and 3.12? shouldn't they be backwards compatible?
<ygrek_>
Dynetrekk, try changing line 4 in update.ml : Map -> MyMap
<ygrek_>
sorry, in update.mli
<Dynetrekk>
ygrek_: it's magic! thanks a lot!
<Dynetrekk>
I have to write this down somewhere :P
<ygrek_>
it is bug of unison, ping the authors
<Dynetrekk>
ygrek_: it is? I will try to do that
<Dynetrekk>
ygrek_: I don't know ocaml myself at all
<ygrek_>
yes
<Dynetrekk>
says on the mailing list that the bug is fixed in the code repository
ygrek_ has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
Yoric has joined #ocaml
ikaros has joined #ocaml
elehack has quit [Read error: Operation timed out]
elehack has joined #ocaml
Modius has joined #ocaml
pikachuyann has quit [Quit: à samedi prochain]
Dynetrekk has quit [Quit: Dynetrekk]
hcube has quit [Ping timeout: 240 seconds]
ygrek_ has quit [Ping timeout: 245 seconds]
Elench has joined #ocaml
ygrek_ has joined #ocaml
RyanRN has quit [Ping timeout: 245 seconds]
ftrvxmtrx has quit [Read error: Connection reset by peer]
elehack is now known as elehack|afk
Elench has quit [Remote host closed the connection]
Elench has joined #ocaml
ftrvxmtrx has joined #ocaml
yezariaely has joined #ocaml
hcube has joined #ocaml
yezariaely has left #ocaml []
init1 has joined #ocaml
hcube has quit [Ping timeout: 276 seconds]
Smerdyakov has joined #ocaml
<orbitz>
hey Smerdyakov, i just started readign The Brothers Karamazov
<Smerdyakov>
Here's your cookie! :)
<orbitz>
ohhh i love cookies!
Dynetrekk has joined #ocaml
drunK has joined #ocaml
munga has quit [Ping timeout: 240 seconds]
avsm has joined #ocaml
coucou747 has quit [Quit: 0x2a]
Dynetrekk has quit [Quit: Dynetrekk]
Dynetrekk has joined #ocaml
Yoric has quit [Ping timeout: 240 seconds]
Dynetrekk has quit [Client Quit]
Yoric has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
hcube has joined #ocaml
Edward_ has joined #ocaml
jeff2 has joined #ocaml
<jeff2>
what is the OCaml equivalent of the Python (for example) def f(): return; f.func_name == "f"? basically, how can I get the name of a function as a string?
<thelema>
jeff2: you can't - it's not a string
<thelema>
it's not accessible to the runtime as a string
<jeff2>
thelema: alright. how about the opposite, is that possible?
<thelema>
given a string, find the function with its name?
<orbitz>
jeff2: this is not how you generallyd esign software in ocaml
<thelema>
In theory, you could build a hashtable with functions mapping to strings, and another for the reverse mapping, but this is probably not the right way to do this kind of thing in ocaml
<orbitz>
thelema: woudln'tyou need a hash for each funciton type?
Dynetrekk has joined #ocaml
<thelema>
orbitz: yes, all the functions would have to be the same type
<jeff2>
that's fine
<schmrkc>
jeff2: Why do you want this?
<orbitz>
jeff2: you probably don't wna to do thi sthouhg
<thelema>
jeff2: why do you need this?
<adrien>
(and I was about to add yet another line like that :-) )
<orbitz>
haha
<schmrkc>
(:
<jeff2>
I can use a map, I just was trying to avoid having to repeat myself. I'm trying to make a sort of disassembler/emulator, where each opcode has a function for its implementation
<jeff2>
so MOV would be implemented in opcodeMOV
Dynetrekk has quit [Client Quit]
<jeff2>
(etc.) and there are a lot of opcodes
<thelema>
yes, doing this through strings isn't the right way to do it.
<jeff2>
what's a better way?
iris1 has quit [Quit: iris1]
<thelema>
A variant type wouldn't be bad.
<jeff2>
can I print a variant type?
<thelema>
not as trivially as it should be.
<thelema>
you'll have to stringify it yourself
<adrien>
wouldn't type-conv work for that?
<thelema>
yes, there's some camlp4 that helps with this
<thelema>
Doing this, you'd probably end up with one mega-match expression that evaluates all your opcodes - is that a problem?
<adrien>
on the other hand, you'd be warned if you forget some cases and the "content" of the expression is not hard
<thelema>
There's some ways to use polymorphic variants to break this into smaller functions, if needed, but it's a bit more complex.
<adrien>
more like : | MOV -> func_mov
<orbitz>
will the match be optimized well for a tight loop?
<adrien>
I'm also wondering: I always forget the answer =/
<thelema>
with a variant, yes. strings - no
<thelema>
small matches don't get table-jump-optimized, large ones do, IIRC
<jeff2>
hmm, I think variant types will work well for my purposes
gildor has quit [Ping timeout: 250 seconds]
gildor has joined #ocaml
avsm1 has quit [Quit: Leaving.]
avsm has joined #ocaml
ztfw has quit [Remote host closed the connection]
init1 has quit [Quit: Quitte]
Snark has quit [Quit: Ex-Chat]
Dynetrekk has joined #ocaml
Dynetrekk has quit [Client Quit]
coucou747 has joined #ocaml
_unK has joined #ocaml
drunK has quit [Ping timeout: 265 seconds]
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 245 seconds]
ulfdoz has quit [Ping timeout: 265 seconds]
_unK is now known as drunK
elehack|afk has quit [Ping timeout: 276 seconds]
elehack has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
BiDOrD has joined #ocaml
Yoric has quit [Quit: Yoric]
hcube has quit [Ping timeout: 265 seconds]
ygrek_ has quit [Ping timeout: 245 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
munga has joined #ocaml
munga has quit [Ping timeout: 276 seconds]
coucou747 has quit [Remote host closed the connection]