companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
jbrown has quit [Ping timeout: 246 seconds]
smazga has quit [Ping timeout: 246 seconds]
jbrown has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
Tuplanolla has quit [Ping timeout: 264 seconds]
sagax has quit [Quit: Konversation terminated!]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
olle has quit [Ping timeout: 260 seconds]
olle has joined #ocaml
ArthurStrong has quit [Quit: leaving]
raver has quit [Read error: Connection reset by peer]
vicfred has quit [Quit: Leaving]
schlaftier has quit [Ping timeout: 260 seconds]
smazga has joined #ocaml
nullcone has joined #ocaml
jbrown has quit [Ping timeout: 272 seconds]
smazga has quit [Ping timeout: 256 seconds]
jbrown has joined #ocaml
schlaftier has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
nicoo has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
<d_bot> <zbaylin> @antron sorry to bother but I have a quick question about `Luv`
<d_bot> <zbaylin>
<d_bot> <zbaylin> If I have a `Unix.file_descr` that refers to a socket, is it possible to "convert" this to an `Luv.Os_fd.Socket.t`? I saw here you used `Obj.magic` to go from `Unix.file_descr -> Luv.File.t` (https://github.com/aantron/luv/blob/fb87c477a4a611457f6aeabfb542f4e927c78768/test/pipe.ml#L58), but I didn't know if that should also work going to a different socket type, since IIRC POSIX sockets are integral types and I'm not quite sure h
sleepydog has joined #ocaml
narimiran has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
ome has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
amiloradovsky has quit [Remote host closed the connection]
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
zebrag has quit [Quit: Konversation terminated!]
<d_bot> <antron> @zbaylin Obj.magic should work on Linux for this. however this is not a "legitimate" solution of course, and i am using it in the test suite to work around that i removed the "real" solution earlier to get rid of a dependency on unix. you can see the code that did the conversion "correctly" in the deleted code in this diff https://github.com/aantron/luv/commit/705ec144a9f047260de8140583e88d016e33e061, perhaps that can help you to
<d_bot> <zbaylin> Awesome, thanks -- let me know if you want any help with that lib
retropikzel has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
schlaftier has quit [Quit: Ping timeout (120 seconds)]
schlaftier has joined #ocaml
ome has quit [Quit: Connection closed for inactivity]
mro_name has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 272 seconds]
mro_name has quit [Quit: Leaving...]
osa1 has quit [Quit: osa1]
osa1 has joined #ocaml
dborisog has joined #ocaml
Serpent7776 has joined #ocaml
Haudegen has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
shawnw has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 260 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
olle_ has joined #ocaml
retropikzel has left #ocaml ["Leaving"]
olle_ has quit [Client Quit]
smazga has joined #ocaml
olle_ has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
smazga has joined #ocaml
steenuil has joined #ocaml
bartholin has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
wingsorc has quit [Quit: Leaving]
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
l1x has joined #ocaml
smazga has joined #ocaml
mbuf has joined #ocaml
smazga has quit [Ping timeout: 260 seconds]
narimiran has quit [Ping timeout: 246 seconds]
narimiran has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
mfp has joined #ocaml
mbuf has quit [Quit: Leaving]
ahf_ is now known as ahf
ome has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 272 seconds]
Haudegen has joined #ocaml
smazga has joined #ocaml
nullifidian has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
<olle_> Would it be possible to compile a language to C and include OCaml GC support in it?
<olle_> That is, can the OCaml GC be used from C? Should be similar to write a lib to OCaml in C, no? But you need to bootstrap the runtime somehow.
Serpent7776 has quit [Ping timeout: 256 seconds]
<companion_cube> you need all values to be ocaml values
<companion_cube> see caml/value.h iirc
smazga has joined #ocaml
<olle_> companion_cube: boxed? yes, sure.
<olle_> Is that enough for the GC to find them? I was thinking about the stack and stuff.
<olle_> Hm, I should read this first: https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html
smazga has quit [Ping timeout: 264 seconds]
<olle_> dinosaure: thanks, will save that.
zebrag has joined #ocaml
Serpent7776 has joined #ocaml
<olle_> what's this thing? `
<olle_> __attribute__ ((__constructor__))`
<d_bot> <dinosaure> it run the function during the program startup - by this way, if you make a library (as I do in this example), I'm sure that the caml runtime is running even if the end-user did not call `caml_startup`
<olle_> oh ok
<olle_> gcc specific, it seems.
shawnw has quit [Ping timeout: 256 seconds]
<d_bot> <dinosaure> yes :/ but I think, you should find something close for `clang`
<olle_> alright :)
<companion_cube> olle_: enjoy https://github.com/stedolan/malfunction
ArthurStrong has joined #ocaml
<olle_> companion_cube: I've seen this, I think
nullifidian has quit [Quit: Leaving]
<olle_> companion_cube: Not sure I want to rely on something that never gets updated.
<olle_> Compiling to C is a rather safe bet.
<olle_> Especially since my toy lang will be C-like. I think. :O
<olle_> I tried compiling to LLVM 6 years ago, but GC in LLVM is painful bullshit.
<olle_> Otherwise I love the LLVM IR.
<companion_cube> well good luck
<olle_> hehe
<companion_cube> afaik, often, languages that compile to C tend to use refcounting, not a tracing GC
<companion_cube> (e.g. nim)
<olle_> companion_cube: well, you end up having to take care of cyclical data?
<olle_> but maybe they want deterministic destruction. I've thought about this.
<olle_> Didn't know Nim compiles to C, actually.
<olle_> All I want is a language able to perform good-ish on both the n-body benchmark and the binary tree benchmark (using GC)
<olle_> We'll see
<d_bot> <stab> i mean nim has a new garbage collector 😉
<d_bot> <stab> as i understand it the general idea is just use reference counting then cycle collection phases no?
<olle_> no idea, I don't want to write any gc code myself
<d_bot> <stab> uh yeah that's gonna be harder but couldnt you just compile to C then use a C garbage collector technically
<olle_> no
<d_bot> <stab> if you dont want to do the llvm thing
<olle_> I want opt-in stack allocation
<olle_> boehm et al scan the stack, it can't differentiate between what should and shouldn't be collected (I think?)
<olle_> it's all or nothing, AFAIK
<d_bot> <stab> eh maybe this is beyond me but I dont really see the issue with stack allocations?
<olle_> because it's conservative anyway? yeah, maybe...
<olle_> good point
<olle_> hm hm hm
<olle_> it's not completely tight tho, is it?
<olle_> for a long running process
<d_bot> <stab> i mean i dont think you are going to get anything tight without additional work on ur part
<d_bot> <stab> maybe im wrong
<olle_> that's why I wanted to put OCaml in there
<olle_> but since I'm not planning to add any polymorphism, I won't really benefit from boxing everything.
<d_bot> <stab> i dont think that's going to work too well since you said your language is going to be C like
<d_bot> <stab> fundamentally you are going to deal with the same issues C garbage collectors do
<d_bot> <stab> which is being conservative with what you assume is a pointer
<d_bot> <stab> as soon as your language is weakly typed like that basically everything is a pointer until you prove it isnt
<d_bot> <stab> I'd honestly say your best bet for a c like language is just a gcc frontend with a c garbage collector since smart ppl have worked on those
<olle_> stab, no weak types, no casts
<olle_> but, it's just a toy project, nothing serious
<olle_> maybe I should write out some AST...
<d_bot> <stab> eh yeah then maybe it's possible to do better garbage collection but then it would have to be custom so either llvm or your own so you end up with the same issue
<d_bot> <stab> im just saying in terms of no effort on the garbage collection front im pretty sure compiling to c with a garbage collector is probably the best you are going to find. But id ask around in the PL discord
<d_bot> <stab> i think they have an IRC bridge if you are anti discord and there are more people there thinking about programming languages etfc
<d_bot> <stab> I hang around there but im too dumb lol...
<olle_> haha
<olle_> #ocaml is the best channel for prolang discussions ;D
mxns has joined #ocaml
dborisog has quit [Ping timeout: 246 seconds]
l1x has quit [Quit: Connection closed for inactivity]
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
nicoo has quit [Ping timeout: 240 seconds]
zebrag has quit [Quit: Konversation terminated!]
smazga has quit [Ping timeout: 246 seconds]
waleee-cl has joined #ocaml
hnOsmium0001 has joined #ocaml
smazga has joined #ocaml
nicoo has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
zebrag has joined #ocaml
tane has joined #ocaml
DanC has joined #ocaml
mxns has quit [Ping timeout: 246 seconds]
<d_bot> <stab> anybody know anything about Smallfoot in infer?
<d_bot> <stab> if so what does a prune instruction do?
raver has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Bahman has joined #ocaml
mxns has joined #ocaml
rak has quit [Quit: reboot]
rak has joined #ocaml
<theblatte> stab: "prune(B)" is assume(B). They are used to translate the conditional statements, eg if(B) { C1 } else { C2 } becomes a CFG where control flow splits in two, one branch is "prune(B); C1", then other is "prune(!B); C2"
bartholin has quit [Quit: Leaving]
<theblatte> smallfoot was the first separation logic prover, some vestigial remains can still be found in Infer's source code :p
<theblatte> most notably SIL stands for "Smallfoot Intermediate Language", even though Smallfoot's IR looked nothing like that
<d_bot> <stab> so is that the expected way to translate conditional branches currently? or can you associate conditions with edges now somehow or something
<d_bot> <stab> And thanks for the explanation that makes a ton of sense
olle_ has quit [Ping timeout: 246 seconds]
<d_bot> <stab> Im guess the new way has to do with `Prune_node of bool * Sil.if_kind * prune_node_kind` which is a nodekind that you can have so i'd guess maybe what you are supposed to do is create a node of the correct type for each exit etc
<theblatte> stab: yes that's how branches are translated, you can look at examples by running infer with -g and inspecting infer-out/captured/*/proc_cfgs_frontend.dot (or the html debug output in the same folder)
<theblatte> ah, right, a prune node is a node containing a prune instruction (from Sil.instr)
dborisog has joined #ocaml
<d_bot> <stab> thanks that makes sense. and yeah probably just makes sense to look at captured code for constructs that im trying to do and then see what infer does
<d_bot> <stab> im not looking forward to transferring all of SIL into ATD bindings since ive decided it's probably more convenient to do the lifting on the java side... well i either need ATDs for all of ghidra pcode and varnodes or SIL
<d_bot> <stab> *shudder*
<theblatte> stab: if that's the path you're going down to have a look at how microsoft did their C# frontend, they have a json representation for SIL
<d_bot> <stab> cool will take a look! yeah i mean im not sure which is more convenient, lifting on the ghidra side and using the json representation of SIL or representing the ghidra stuff in ATD and then lifting on the Infer side
<d_bot> <stab> I guess if I can use some of microsofts ideas for json smallfoot then maybe that's the way to go and lift on the ghidra side
<theblatte> pretty sure using the json layer is the most convenient way
<theblatte> but I haven't played with it myself yet :)
<d_bot> <stab> lol ill be the guinea pig
<d_bot> <stab> I think it should work fine
<d_bot> <stab> Thanks took a deeper look, pretty promising approach to getting this done
<theblatte> sweet!
ome has quit [Quit: Connection closed for inactivity]
mxns has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
mxns has joined #ocaml
mxns has quit [Client Quit]
mxns has joined #ocaml
amiloradovsky has joined #ocaml
Tuplanolla has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
<olle> not completely trivial how to mix stack allocated value types with heap allocated reference types...
<olle> you can also have a reference to a value type ><
<companion_cube> soon you'll rediscover rust's borrowing :p
<olle> haha yes, I can feel it
<olle> but nah, immutability should be enough
<olle> rust's borrowing is what I want to avoid
<companion_cube> what if you have a reference to a value that lives on the stack
<companion_cube> and the reference lives longer than the stack frame?
<olle> it "can't"
<olle> I forbid it!
<companion_cube> how? :p
<olle> either escape analysis is needed or the language is limited in a way to not make it possible to mix value types with ref types in some way.
<olle> e.g, references to value types are only allowed in function arguments.
<olle> to avoid excessing copying
<olle> excessive*
<d_bot> <Deadrat> just use rust
<olle> boooring
<companion_cube> can the function then put the argument in an array?
<d_bot> <Deadrat> i found its borrow checker quite natural after ocaml
<d_bot> <Deadrat> i dunno whats hard about it if you are not writing libraries or cyclical data structures
<olle> companion_cube: that's what I was thinking about on the bus home... maybe, but only in a stack allocated array?
<companion_cube> how do you make the difference?
<companion_cube> what if the array is allocated lower on the stack?\
<olle> between what? references to value types and references to heap allocations?
<companion_cube> yeah
<olle> layout kinds?
<companion_cube> and between an array earlier, or later, than the reference
<olle> you have a struct Point, but in the type system it's always either ref Point or val Point
<olle> and &val point, possibly
<olle> where ref Point is the OCaml box
<olle> for the GC
<companion_cube> ah, so on the heap
<companion_cube> I mean if you can't take references to value types, the problem does vanish
<companion_cube> (like in OCaml with, say, `int`)
<olle> Yes
mxns has quit [Quit: ZNC 1.8.2 - https://znc.in]
mxns has joined #ocaml
<olle> I was teasing my brain with a function like new_rectangle(p1: &val Point, p2: ref Point) return Rectangle {p1, p2};
<olle> What the hell should happen there?
<companion_cube> &val Point seems like exactly the kind of thing you don't want
narimiran has quit [Ping timeout: 246 seconds]
<olle> companion_cube: I was thinking allowing it in function arguments could be safe-ish
Anarchos has joined #ocaml
narimiran has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
dborisog has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
<companion_cube> the function could do what it wants with them, so, no?
haesbaert has quit [Ping timeout: 256 seconds]
vicfred has joined #ocaml
waleee-cl has quit [Read error: Connection reset by peer]
waleee-cl has joined #ocaml
<olle> yeah
<olle> unless it's constrained somehow. but let's keep it simple.
mxns has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
mxns has quit [Ping timeout: 246 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
mxns has joined #ocaml
narimiran has quit [Ping timeout: 265 seconds]
haesbaert has joined #ocaml
tmhoang has quit [Quit: Ping timeout (120 seconds)]
jnavila has joined #ocaml
tmhoang has joined #ocaml
<cemerick> is anyone aware of an ocamlformat setting that would result in the case bars in `disj` here retaining their alignment? https://gist.github.com/cemerick/1f8f37c2de5c7f9e32ecda7e2a8859d3
Serpent7776 has quit [Quit: leaving]
<companion_cube> probably an annotation to tell ocamlformat to not touch that? :)
<cemerick> hah
<cemerick> I thought I'd be able to pick my way through its options to eventually land on something acceptable across the codebase
<cemerick> adding attributes to shield various parts might be a bridge too far
jnavila has quit [Quit: Konversation terminated!]
sleepydog has quit [Quit: leaving]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
<olle> I wonder if I would have liked rust had they kept the sigil operators ~ and @
<olle> Maybe I should just fork their 0.9 version, lol.
<companion_cube> it removed the sigils because they were not builtins anymore
<olle> sad
<olle> then add them as standard notation as |> in ML?
<companion_cube> people already complain that rust has too many sigils
<olle> hehe
<olle> let%. let*, let
<olle> :)
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 256 seconds]
tane has quit [Quit: Leaving]
<olle> also, one ~ would replace two <>
<olle> so... less chars on screen???
inkbottle has quit [Quit: Konversation terminated!]
inkbottle has joined #ocaml
ArthurStrong has quit [Quit: leaving]
Haudegen has quit [Ping timeout: 256 seconds]
mxns_ has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]