adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
weird_error has joined #ocaml
TC01_ has joined #ocaml
TC01 has quit [Ping timeout: 276 seconds]
spew has quit [Quit: Connection closed for inactivity]
AtumT has quit [Quit: AtumT]
ale64bit has joined #ocaml
kotrcka has quit [Ping timeout: 248 seconds]
kotrcka has joined #ocaml
ziyourenxiang has joined #ocaml
pera has quit [Ping timeout: 245 seconds]
pera has joined #ocaml
mfp has quit [Ping timeout: 245 seconds]
KeyJoo has joined #ocaml
silver_ has quit [Read error: Connection reset by peer]
keep_learning has joined #ocaml
ale64bit has quit [Ping timeout: 252 seconds]
ale64bit has joined #ocaml
ale64bit has quit [Ping timeout: 246 seconds]
KeyJoo has quit [Quit: KeyJoo]
cobreadmonster has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
ihavelotsoffries has joined #ocaml
ihavelotsoffries has quit [Changing host]
ihavelotsoffries has joined #ocaml
ihavelotsoffries has joined #ocaml
<ihavelotsoffries> Hello
<ihavelotsoffries> can someone please explain this type for me:
<ihavelotsoffries> and ('a, 'kind) structured = { structured : ('a, 'kind) structured ptr }
<ihavelotsoffries> that is from ctypes. structured is a structured is a polymorphic record with field structured that is a ptr to a structured and so far?
<ihavelotsoffries> wouldn't that make it infinity recursive?
<CcxWrk> Just guessing, but I assume ptr breaks the recursion (by possibly being NULL, or referring to some item in a cyclical way )
<CcxWrk> But I think there's more to it.
<ihavelotsoffries> well, if it can be null, the it can't encode much, can it?
<ihavelotsoffries> It has be a lil confused.
zv has quit [Quit: WeeChat 2.2]
gravicappa has joined #ocaml
<CcxWrk> Is this generated by ctypes or is this from ctypes proper? If the former, what is the C counterpart?
<ihavelotsoffries> ctypes proper.
Birdface has joined #ocaml
cobreadmonster has quit [Quit: Connection closed for inactivity]
pera has quit [Ping timeout: 252 seconds]
wklm has joined #ocaml
tane has joined #ocaml
wklm has quit [Ping timeout: 244 seconds]
picolino has quit [Ping timeout: 252 seconds]
ihavelotsoffries has quit [Ping timeout: 248 seconds]
picolino has joined #ocaml
freyr69 has joined #ocaml
wklm has joined #ocaml
Haudegen has joined #ocaml
gahr_ is now known as gahr
dhil has joined #ocaml
ShalokShalom has joined #ocaml
<hannes> in real world ocaml, the binary representation of variants (and polyvars) is explained, which is fine. is there some similar documentation for GADTs?
<Drup> hannes: it's the same one
<hannes> Drup: thanks!
mfp has joined #ocaml
<freyr69> I need help with OCaml ffi
<freyr69> I receive callbacks in C function, store them in a tuple and return this tuple with CAMLreturn
<freyr69> However GC collects them
<freyr69> Why and what should I do?
<zozozo> freyr69: do you store them somewhere aside from the tuple that you return ?
<zozozo> if the tuple becomes unreachable, it's expected that the callbacks would be collected along the tuple
<pgiarrusso> most GCs don't look for references on the C heap, so they don't know you have a reference there
<pgiarrusso> you usually need to call some GC API to inform the GC that something is referred to on the C side
<pgiarrusso> Worse, the C code is not happy if the GC moves stuff, so you also need some solution for that
<freyr69> zozozo: nope
<pgiarrusso> *dunno in OCaml*, but is it any different?
<zozozo> freyr69: well then, why is it a problem is the callbacks are collected if they are unreachable ?
<freyr69> zozozo: even if the tuple is reachable&
<freyr69> ?
<zozozo> freyr69: if the tuple is reachable, then the callbacks shouldn't be collected, that's for sure
<freyr69> I'm storing them exactly for that reason
<freyr69> They are for some reason
<pgiarrusso> https://v1.realworldocaml.org/v1/en/html/foreign-function-interface.html "Lifetime of Allocated Ctypes" has a variant of that
Travis__ has joined #ocaml
<pgiarrusso> freyr69: are you storing them in OCaml data or C data
<pgiarrusso> ?
<zozozo> freyr69: modifying fields of an ocaml struct should be done using the caml_modify function iirc
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom has joined #ocaml
<freyr69> You mean Field(..) = is the source of my troubles?
<zozozo> it might (I'm not sure enough though), have you read https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec441 ?
<freyr69> pgiarrusso: in 'alloc_tuple'
traviss has joined #ocaml
<freyr69> I need caml_initialize, I see
Travis__ has quit [Ping timeout: 248 seconds]
traviss has quit [Client Quit]
<freyr69> thanks
traviss has joined #ocaml
<pgiarrusso> freyr69: apart from that should work if the writes to the OCaml heap are done properly, meaning, apparently, with Store_field
<pgiarrusso> Otherwise you risk problems
kotrcka has quit [Ping timeout: 252 seconds]
<pgiarrusso> In the GCs I have in mind, the problems might happen seldom, so "it seems to work" isn't a strong guarantee :-(
kotrcka has joined #ocaml
<freyr69> pgiarrusso: btw is there any way to store OCaml data in C code?
<freyr69> So the GC wouldn't move or collect value?
<freyr69> for example callback?
<pgiarrusso> This seems relevant: > Rule 4 Global variables containing values must be registered with the garbage collector using the caml_register_global_root function.
<pgiarrusso> Because it sounds like what I described at the beginning (tho it wasn't relevant to your problem)
jaar has joined #ocaml
<freyr69> pgiarrusso: Aha, does it mean that after that I could safely use a pointer to this variable from C til I unregister it?
Birdface has quit [Ping timeout: 248 seconds]
<flux[m]> yes. registering it as a root means the GC won't move it.
<flux[m]> copying OCaml values to C heap has the problem that pointers from such data to OCaml heap could become invalid at some point
<freyr69> flux[m]: So is it safe to store a reference to an OCaml value in C, if it was registered?
<flux[m]> freyr69: yes
tane has quit [Remote host closed the connection]
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom has joined #ocaml
silver has joined #ocaml
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom has joined #ocaml
zolk3ri has joined #ocaml
ShalokShalom has quit [Read error: Connection reset by peer]
ShalokShalom_ has joined #ocaml
tane has joined #ocaml
<Leonidas> Unregistered copy of HyperOCam2
ShalokShalom_ has quit [Read error: Connection reset by peer]
ggole has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 250 seconds]
zolk3ri has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 248 seconds]
dhil has joined #ocaml
spew has joined #ocaml
<freyr69> What could cause segfault in caml_oldify_local_roots, bad roots?
lyxia has quit [Quit: WeeChat 2.4]
lyxia has joined #ocaml
lyxia has quit [Client Quit]
lyxia has joined #ocaml
<wilfredh> I have an issue where dune can't find a package, but opam think it is installed
<wilfredh> am I doing something silly? The package in question is uutf.
<vsiles> wilfredh: probably not the issue, but is your state clean ? (did you run eval $(opam env))
<vsiles> last time I had a mismatch like this it was because of that
<wilfredh> re-running `eval $(opam env)` produced the same behaviour
<wilfredh> is there any other state I should look at?
<vsiles> cat you post/paste your dune-workspace ?
<wilfredh> ooh, that looks wrong
<vsiles> yes you might want to refresh that
<vsiles> looks like it instructs dune to use your 4.05 repo (which doesn't have uutf it seems)
<wilfredh> awesome, it works! Thanks vsiles :)
<vsiles> you're welcome
pera has joined #ocaml
ShalokShalom has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
dhil has joined #ocaml
kotrcka has quit [Ping timeout: 268 seconds]
ShalokShalom has quit [Read error: Connection reset by peer]
kotrcka has joined #ocaml
pippijn_ is now known as pippijn
porcupine has joined #ocaml
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
Niamkik has joined #ocaml
AtumT has joined #ocaml
AtumT_ has joined #ocaml
AtumT has quit [Ping timeout: 245 seconds]
TheLemonMan has joined #ocaml
freyr69 has quit [Read error: Connection reset by peer]
AtumT has joined #ocaml
AtumT_ has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
traviss has quit [Quit: Leaving]
_whitelogger has joined #ocaml
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
dtornabene has joined #ocaml
zolk3ri has joined #ocaml
<seastack> smondet[m]: Indeed, that is exactly what I was looking for - thank you! https://opam.ocaml.org/blog/opam-local-switches/#Using-within-projects
Serpent7776 has joined #ocaml
jaar has quit [Quit: Leaving]
porcupine has quit [Ping timeout: 248 seconds]
wklm has quit [Ping timeout: 248 seconds]
andreas31 is now known as andreas303
ggole has quit [Quit: Leaving]
porcupine has joined #ocaml
weird_error has quit [Quit: weird_error]
weird_error has joined #ocaml
weird_error has quit [Quit: weird_error]
Birdface has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
gravicappa has quit [Ping timeout: 248 seconds]
Facebird has joined #ocaml
Birdface has quit [Ping timeout: 264 seconds]
weird_error has joined #ocaml
kakadu_ has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
oni-on-ion has joined #ocaml
dtornabene has quit [Quit: Leaving]
dhil has quit [Ping timeout: 245 seconds]
jnavila has joined #ocaml
Haudegen has joined #ocaml
jnavila has quit [Ping timeout: 245 seconds]
porcupine has quit [Quit: Leaving]
jnavila has joined #ocaml
weird_error has quit [Quit: weird_error]
zolk3ri has quit [Remote host closed the connection]
zolk3ri has joined #ocaml
Serpent7776 has quit [Quit: leaving]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
Facebird has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Leaving]
[rg] has joined #ocaml
clog has quit [Ping timeout: 244 seconds]
clog has joined #ocaml
jnavila has quit [Remote host closed the connection]
<[rg]> hate to be that guy, but why ocaml?
zolk3ri has quit [Quit: leaving]
kakadu_ has quit [Remote host closed the connection]
<oni-on-ion> why what ?
<oni-on-ion> why "[rg]"?
<oni-on-ion> the name itself comes from Objective-CAML, from CAML, from ML, from ...
<oni-on-ion> the choice itself as a professional development toolchain is very particular about the circumstances. ie. boats for water, trucks for haulin, cars for racin
<[rg]> so the thing for ocaml is that it is object like, or are there other things
<[rg]> also which resource to start with in ocaml?
[rg] has quit [Read error: Connection reset by peer]
oni-on-ion has quit [Ping timeout: 248 seconds]
Haudegen has quit [Remote host closed the connection]
[rg] has joined #ocaml
<[rg]> bartholin: so its fine to depend on there library? or is it community adopted?
<[rg]> their*
<bartholin> it's fine
<bartholin> The subcommunity of people who use the JaneStreet libraries is important
<[rg]> ok, I'll go with this resource
[rg] has quit [Quit: Konversation terminated!]
ale64bit has joined #ocaml
[rg] has joined #ocaml
spew has quit [Quit: Connection closed for inactivity]
ale64bit has quit [Ping timeout: 252 seconds]
Birdface has joined #ocaml
[rg] has quit [Quit: Konversation terminated!]