<Leonidas>
it does an alloc_small and stores some C value in that block and to free it it just zeroes the inner pointer?
<thizanne>
yeah apart from the really simple stuff I don't know the details of the ocaml runtime
<Leonidas>
ah, I think I understand it! The thing that is alloc_small'd is passed to the OCaml side, from where the ocaml GC knows when it can discard it.
<thizanne>
that's how I understand it
<thizanne>
and I guess hdl is supposed to be an ocaml value as well ?
<Leonidas>
thizanne: still, thanks for rubber-ducking :-)
<Leonidas>
thizanne: no, it should some pointer to some C reference.
<def`>
Leonidas: no the GC is aware of it as soon as it is allocated.
<def`>
that's why there are these CAMLparam, CAMLlocal and CAMLreturn macros.
<def`>
their purpose is to track all OCaml values
Serpent7776 has quit [Quit: Leaving]
<Leonidas>
def`: but I can stash `value`s away, and how does the GC know that this is used or not?
<Leonidas>
hmm, guess it can't, so it just tries to deallocate it, which is why one needs to `caml_register_global_root` to prevent it from doing so, correct?
valtr has quit [Quit: Quit]
<def`>
yes
<def`>
stashing away is an incorrect use of the FFI
<companion_cube>
you do need to make it a root, yes
<smondet>
do tell the GC about stuff "somewhere else" (usually malloc) you need `alloc_custom` (which takes a structure that itself has a function pointer to a `free_my_stuff` procedure)
FreeBirdLjj has joined #ocaml
ygrek__ has joined #ocaml
smazga has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
ziyourenxiang has quit [Ping timeout: 258 seconds]
<companion_cube>
dmbaturin: ♥ on lobsters :D
<dmbaturin>
companion_cube: Which post? The theological monads? :)
vicfred has joined #ocaml
<companion_cube>
nah, Go
<companion_cube>
who doesn't love hating on Go?
<dmbaturin>
I've caught a nasty cold, so I'm mostly spending time writing borderline nonsense and trivial truths on the internets as my brain is not good for anything else this week.
<companion_cube>
:DDDDD
<companion_cube>
oh well, I had to contribute to the bashing anyway
<dmbaturin>
Boehm GC is actually quite nice as far as GC for C go. :)
<dmbaturin>
On a side note, I'm actually going to stop for a time after soupault 1.9 and make a eztoml library with polymorphic variants.
<companion_cube>
yessssss
<companion_cube>
please make a basic, pragmatic API :)
<companion_cube>
oh damn, flashbacks of writing toml config code
<companion_cube>
thankfully on that particular project I now use S-expressions
<companion_cube>
(with ocaml-decoders)
<dmbaturin>
Half that file is fighting with to.ml's tacit assumption that the program is not extensible and will always know what value types it expected _and_ wants to punish the user for getting the the wrong.
<dmbaturin>
I find TOML the language much easier to use in anger than S-exps, but to.ml is doing its best to ruin the joy of it for this particular use case.
andreas303 has quit [Remote host closed the connection]
<companion_cube>
oh really? S-exprs are really so simple
<companion_cube>
(also, I managed to have a parser with locations, so I can report errors properly)
<dmbaturin>
Then again, since TOML is dynamically typed, I do think there should be an easy way get a value and fo the type conversion if necessary, or produce a clear type mismatch error.
<dmbaturin>
Pretending that a key doesn't even exist if its value is not of the type you expect is user-hostile.
andreas303 has joined #ocaml
<companion_cube>
tbh I'd mostly like to get a good parser/printer with just the type def
<companion_cube>
and if you want a fancy lens API, make another damn library
<dmbaturin>
companion_cube: (unsat ":status unsat") How that status is obtained?
<dmbaturin>
Well, what that line really does?
<companion_cube>
where exactly?
_whitelogger has quit [Ping timeout: 248 seconds]
peddie has quit [Ping timeout: 240 seconds]
dl3br[m] has quit [Ping timeout: 256 seconds]
jimt[m] has quit [Ping timeout: 256 seconds]
sepp2k has quit [Ping timeout: 246 seconds]
bglm[m] has quit [Ping timeout: 256 seconds]
haesbaert has quit [Ping timeout: 268 seconds]
FreeBirdLjj has quit [Remote host closed the connection]