companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
waleee has quit [Ping timeout: 268 seconds]
waleee has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
azimut_ has quit [Remote host closed the connection]
azimut has joined #ocaml
rgrinberg has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
williewillus has joined #ocaml
mima has quit [Ping timeout: 248 seconds]
John_Ivan has quit [Ping timeout: 268 seconds]
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
jpds has quit [Remote host closed the connection]
jpds has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dh` has quit [Read error: Connection reset by peer]
dh` has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
adanwan has quit [Read error: Connection reset by peer]
adanwan has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
random-jellyfish has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuplanolla has joined #ocaml
rgrinberg has joined #ocaml
reynir has joined #ocaml
<sim642> Luckily the new site generates HTML docs even for packages that don't publish it themselves: https://ocaml.org/p/re/1.10.4/doc/index.html
<sim642> Except when that documentation generator is somehow broken
<Armael> why is it broken?
<Armael> (I mean, what makes you say that?)
<sim642> Maybe it's fixed now, but this was the issue: https://github.com/ocaml/ocaml.org/issues/560
<sim642> Half of those example links work now, half are still 404
sagax has quit [Remote host closed the connection]
jpds has quit [Remote host closed the connection]
jpds has joined #ocaml
Serpent7776 has quit [Quit: leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
<Armael> oh, indeed
rgrinberg has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 268 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
williewillus has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
mima has joined #ocaml
olle has joined #ocaml
bartholin has joined #ocaml
wonko has joined #ocaml
adanwan has quit [Ping timeout: 268 seconds]
adanwan has joined #ocaml
rgrinberg has joined #ocaml
random-jellyfish has quit [Quit: Client closed]
rgrinberg has quit [Ping timeout: 268 seconds]
bartholin has quit [Ping timeout: 252 seconds]
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 268 seconds]
olle has quit [Ping timeout: 268 seconds]
azimut_ has quit [Remote host closed the connection]
azimut has joined #ocaml
spip has joined #ocaml
bobo_ has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
bartholin has joined #ocaml
John_Ivan has joined #ocaml
wonko has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 268 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
bartholin has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
jpds has quit [Remote host closed the connection]
jpds has joined #ocaml
rgrinberg has quit [Ping timeout: 268 seconds]
bartholin has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
jpds has quit [Ping timeout: 268 seconds]
jpds has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
bartholin has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
szkl has joined #ocaml
bartholin has joined #ocaml
olle has joined #ocaml
wonko has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
waleee has quit [Ping timeout: 268 seconds]
rgrinberg has joined #ocaml
jpds has quit [Ping timeout: 268 seconds]
jpds has joined #ocaml
rgrinberg has quit [Ping timeout: 268 seconds]
rgrinberg has joined #ocaml
bartholin has quit [Ping timeout: 268 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
bartholin has joined #ocaml
williewillus has joined #ocaml
waleee has joined #ocaml
<olle> How do y'all format pipes?
<olle> thing |> thong
<olle> new line?
<olle> |> on new line, or end of old line?
<companion_cube> these days I let ocamlformat decide
<companion_cube> but both are fine, depending on the length of the line
<companion_cube> for multiline, I always start with |> though.
<olle> Hm hm
<olle> Yeah, I should use ocamlformat. Standards = good
<companion_cube> well you still need to pick a config 😂
<olle> Waaat
<olle> There's more than one? Pah.
<olle> Best simple graph structure in OCaml? Assoc list?
<olle> I'm thinking type graph = (id * id list) list
<olle> id = variable identifier in a scope
<olle> Unique for that scope
<companion_cube> look at ocamlgraph
<companion_cube> (or perhaps, if you want to do it by hand: `id list Hashtbl.Make(ID).t`
<companion_cube> )
bartholin has quit [Ping timeout: 268 seconds]
<olle> ocamlgraph looked crazy complex
<olle> Yep, hashtbl like that would work too
<companion_cube> it'd be significantly faster for anything but tiny graphs
<olle> That too
<olle> Tiny Graph is nice hip hop name
<sim642> If you're crazy, you could also build a very imperative graph with node records and mutable fields
<companion_cube> > crazy
<companion_cube> > describes something I do all the time
<companion_cube> 😅
azimut has quit [Ping timeout: 268 seconds]
zebrag has joined #ocaml
<olle> Hm
<olle> Let's just stick to hashtbl for now...
brettgilio has quit [Ping timeout: 268 seconds]
bartholin has joined #ocaml
wonko has quit [Ping timeout: 255 seconds]
<olle> Eh, can hashtbl be used in test_eq...?
<olle> to_seq, perhaps
<companion_cube> with alcotest?
<olle> Eh?
<olle> Hm
<companion_cube> what's the test_eq you talk about
<olle> companion_cube: I wanna get all variable identifiers of all escaping variables from a function body (list of statements)
<olle> Basically all `Return (Variable id)`
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<olle> Or `Return expression` etc etc
<olle> Seems like there's no easy way to dump a Hashtbl to a list. Weird.
<olle> Only Hashtbl.iter
<olle> But order is unspecified then
<olle> Maybe just fuck the hashtbl then
<olle> Or test_eq expects hashtbl from Base, urgh and double urgh
zebrag has quit [Read error: Connection reset by peer]
<olle> But without hashtbl i'd have to copy the whole list at each update, lol
<olle> First time I miss PHP "array" nightmare, haha
zebrag has joined #ocaml
wonko has joined #ocaml
<olle> Oh maybe Hashtble.to_seq |> Seq.map --> \o/
<companion_cube> Order is always unspecified
<companion_cube> But where does test_eq come from?
<olle> companion_cube: companion_cube: [%test_eq: Ast.typ list] bla bla
<olle> ppx_inline_test
<companion_cube> Ah OK !
<olle> Unspecified order is fine as long as it's always the same order between test runs...
<companion_cube> I have no idea how that works:p
<olle> Well, there's no Seq.to_list, but there's List.of_seq ^^
mima has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
<dh`> with any normal hashtable implementation the order is deterministic until the implementation changes
<dh`> but for test runs you're better off feeding the output through sort
wonko has quit [Ping timeout: 255 seconds]
<olle> Mm
<olle> Or make sure there's always only one element :D
<dh`> also, don't waste time worrying about whether that sort is expensive until you discover a real case where it isn't
<dh`> er, where it is
<dh`> since unless you have test cases dumping out tens of thousands of results you'll never even begin to notice it
<olle> Sure
<olle> I'm mostly scratching my head over the algorithm itself now
<olle> Would not pass leetcode...
<companion_cube> +1 on sorting
<olle> return (malloc thing) <--- escapes
<olle> But if you do calloc, or stack alloc, it will be copied in C
<olle> alloca*
<olle> I need an example where a malloc cannot be replaced with stack alloc...
<olle> Returning a linked list, perhaps
<olle> Maybe I'll just forbid any scope escaping in the languages :d
<olle> language*
<olle> I'll take it to #proglangdesign ^^
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
CalimeroTeknik has quit [Quit: バイバイ]
CalimeroTeknik has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sagax has joined #ocaml
wonko has joined #ocaml
waleee has quit [Ping timeout: 248 seconds]
bartholin has quit [Quit: Leaving]
bobo_ has joined #ocaml
<dh`> uh what? you can't return pointers to your local stack frame in C, it's instant UB
spip has quit [Ping timeout: 268 seconds]
<olle> dh`: No, but you can return the entire struct
<olle> Instead of a pointer to the struct (allocated on the stack)
<olle> For example
<dh`> true though traditionally that wasn't allowed and might not work on legacy targets
<olle> dh`: is it C11? don't remember, but good enough for me :)
<dh`> more a matter of not being supported by some ABI definitions
<dh`> but it's exactly equivalent to passing an extra arg that's a pointer to fill in
<olle> dh`: Yes
<dh`> anyway there are lots of cases where you can't replace malloc with a stack alloc unless you shift the stack alloc outside one or more frames
<dh`> you can always shift the stack alloc out, but on pathological cses it ends up shifting out all the way to main
<olle> dh`: Yeah. One frame up, you can use a pool
<dh`> s/cses/cases/
<olle> A* algo being one example
<dh`> there was some research into this at one point because people wanted to use region allocators (that is, basically stacks) for safe VMs
<dh`> I forget the magic search terms for it though :-(
<olle> MLkit still use something like it, I think
<olle> Trying to infer regions
<olle> But I think the Koka2 approach has better perf result
<dh`> region inference, right
<dh`> afaicr it never worked that well
<olle> Nope, didn't see much except mlkit
<olle> Super-smart GC are probably equally good
<olle> I need to sleep
<olle> Bye! \o
wonko has quit [Ping timeout: 268 seconds]
<dh`> night
olle has quit [Ping timeout: 268 seconds]
rgrinberg has joined #ocaml
wonko has joined #ocaml
wonko has quit [Ping timeout: 255 seconds]