<discocaml>
<akhilindurti> wondering if there's some tool that can detect strongly connected components among a bunch of `let rec ... and` bindings
<discocaml>
<akhilindurti> i'm finding let bindings make it tedious to move code around, so i'm sticking everything in a `let-rec`. i may want to break it up in the future once the code is stabilized
<discocaml>
<contextfreebeer> all of your functions are "mutually recursive"?
<discocaml>
<akhilindurti> yeah it's the easiest way right now to not keep getting `"unbound value foo"` errors when editing code to call functions i happened to define later in the file
<discocaml>
<contextfreebeer> well yeah but...
<discocaml>
<contextfreebeer> I know it's annoying but still
<discocaml>
<Kali> can't you just... define them in order?
<discocaml>
<Kali> that can be an easy way to introduce bugs
<discocaml>
<akhilindurti> in this case that would mean hoisting functions up to re-sort them in dependency order
<discocaml>
<akhilindurti> it happened often enough that it got tedious
<discocaml>
<akhilindurti> probably cause i refactor a lot
<discocaml>
<akhilindurti> but yeah, i'm less concerned about bugs rn cause i'm prototyping
chrisz has quit [Ping timeout: 260 seconds]
david2 has quit [Quit: WeeChat 4.0.5]
david2 has joined #ocaml
hsw_ has joined #ocaml
hsw has quit [Remote host closed the connection]
david2 has quit [Quit: WeeChat 4.0.5]
david2 has joined #ocaml
david2 has quit [Client Quit]
david2 has joined #ocaml
david2 has quit [Client Quit]
xd1le has quit [Quit: xd1le]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
david2 has joined #ocaml
david2 has quit [Client Quit]
deadmarshal_ has quit [Ping timeout: 240 seconds]
greenbagels has quit [Ping timeout: 240 seconds]
daftaupe8 has joined #ocaml
micro has quit [Ping timeout: 272 seconds]
micro_ has joined #ocaml
TrillionEuroNote has quit [Ping timeout: 248 seconds]
daftaupe has quit [Ping timeout: 272 seconds]
daftaupe8 is now known as daftaupe
dnh has joined #ocaml
dnh has quit [Ping timeout: 264 seconds]
wilfred has joined #ocaml
greenbagels has joined #ocaml
deadmarshal has joined #ocaml
chrisz has joined #ocaml
TrillionEuroNote has joined #ocaml
greaser|q has quit [Changing host]
greaser|q has joined #ocaml
waleee has quit [Ping timeout: 255 seconds]
dnh has joined #ocaml
dnh has quit [Ping timeout: 240 seconds]
wilfred has left #ocaml [#ocaml]
dnh has joined #ocaml
dnh has quit [Ping timeout: 240 seconds]
<discocaml>
<sim642> How are let rec-s less tedious to move than let-s?
<discocaml>
<sim642> I think it's the other way around because let-s are uniform whereas let rec-s have and-s for non-first bindings
dnh has joined #ocaml
dnh has quit [Ping timeout: 260 seconds]
dnh has joined #ocaml
dnh has quit [Ping timeout: 258 seconds]
John_Ivan is now known as DicktaThor
dnh has joined #ocaml
dnh has quit [Ping timeout: 252 seconds]
Serpent7776 has joined #ocaml
azimut has quit [Ping timeout: 252 seconds]
alphacentauri has quit [Quit: WeeChat 4.0.5]
dnh has joined #ocaml
alphacentauri has joined #ocaml
dnh has quit [Ping timeout: 245 seconds]
bencef has joined #ocaml
bencef has left #ocaml [#ocaml]
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ocaml
Johann_ has quit [Quit: I probably failed]
Johann has joined #ocaml
dnh has joined #ocaml
dnh has quit [Ping timeout: 258 seconds]
<discocaml>
<octachron> With massive let-rec group, you are also likely to run into generalization issues (because functions are monomorphic until the end of their definition).
dnh has joined #ocaml
dnh has quit [Ping timeout: 246 seconds]
mro has joined #ocaml
dnh has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
bartholin has joined #ocaml
bacam has quit [Quit: reboot]
bacam has joined #ocaml
jlrnick has joined #ocaml
jlrnick has quit [Remote host closed the connection]
jlrnick has joined #ocaml
jlrnick has quit [Ping timeout: 252 seconds]
omegatron has joined #ocaml
jlrnick has joined #ocaml
<theblatte>
is there a way to make memtrace (https://github.com/janestreet/memtrace) gather statistics on several OCaml processes at once in the same invocation? infer forks worker processes and the only thing I've managed to do is dump a profile for a single one of them (which is probably good enough, but curious if there's something obvious I'm missing)
mro has quit [Remote host closed the connection]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
waleee has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
Serpent7776 has quit [Ping timeout: 272 seconds]
waleee has quit [Ping timeout: 258 seconds]
waleee has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
jlrnick has quit [Ping timeout: 245 seconds]
azimut has joined #ocaml
<zozozo>
theblatte: I think you can control the file where the memtrace info is dumped, so at least you should be able to trace all of your processed separately
waleee has joined #ocaml
Tuplanolla has joined #ocaml
wingsorc has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
waleee has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
azimut has quit [Ping timeout: 252 seconds]
azimut has joined #ocaml
bartholin has quit [Quit: Leaving]
dstein64- has joined #ocaml
dstein64 has quit [Ping timeout: 255 seconds]
dstein64- is now known as dstein64
<discocaml>
<akhilindurti> with let-recs, you don't have to move anything. my code can stay where it is, but if i introduce calls to a function, i don't have to re-sort them manually in dependency order
dnh has joined #ocaml
<discocaml>
<akhilindurti> true, this is a downside
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pie_ has quit []
pie_ has joined #ocaml
TrillionEuroNote has quit [Ping timeout: 258 seconds]
TrillionEuroNote has joined #ocaml
<discocaml>
<barconstruction> In a mathematics textbook, everything could be perfectly well-defined regardless of the order of the definitions but almost always, mathematics textbooks are organized in order of dependency. Rarely, for an extremely complicated definition or theorem, one might blackbox the definition or theorem in order to use its results up front and then give the proof or definition later, but it would be quite difficult to read.
<discocaml>
<barconstruction> Perhaps what we are missing is that you have some perfectly reasonable organizational style which conflicts with dependency order and you are not just inserting your definitions in a completely random and haphazard order. If so you should explain and it would help us to understand.
<discocaml>
<barconstruction> Otherwise, imo it would substantially improve the readability of the code if you organized things in order.
<discocaml>
<barconstruction> Moreover it would help to avoid accidental / unintentional cyclic dependencies.
<discocaml>
<barconstruction> To me, definitions not in order of dependency is like starting to build a house at the top and then working your way down, putting bricks in mid air and inserting them casually.
greenbagels has quit [Ping timeout: 240 seconds]
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 252 seconds]
<discocaml>
<barconstruction> I also don't follow your argument about refactoring. To me the only time refactoring would force you to do this is if `f` originally depended on `g` but you wanted to refactor so that `g` depended on `f`. This seems like a fairly infrequent refactor, because it would be refactoring not just organization but the basic causal logic of the program
TrillionEuroNote has quit [Ping timeout: 255 seconds]
<discocaml>
<akhilindurti> > imo it would substantially improve the readability of the code
<discocaml>
<akhilindurti> I don't dispute this. and once i end up publishing this code for people to read, i'll probably re-partition all these `let-rec` definitions and sort them in dependency order (which is why i asked my original question if there was a tool to help me do that).
<discocaml>
<akhilindurti> But during development, it interrupts my prototyping/iteration if every time a function defined above suddenly needs to depend on one defined below, i have to move things around (and it happens quite a lot from my experience).
<discocaml>
<barconstruction> 👍
greenbagels has joined #ocaml
<src>
I just had a simple btree in OCaml and on a whim thought "how would I implement this in C++"
<src>
I'm still largely stupid when it comes to programming and in no way a master of C++, but partly it sure as hell seems OCaml is brilliantly elegant regarding certain data structures and operations, especially "self-referencing ones" while w/ C/C++ you end up with... A MESS