companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
xd1le has joined #ocaml
waleee has joined #ocaml
chrisz has quit [Ping timeout: 246 seconds]
chrisz has joined #ocaml
waleee has quit [Ping timeout: 248 seconds]
czy has quit [Remote host closed the connection]
immutable has quit [Ping timeout: 248 seconds]
immutable has joined #ocaml
czy has joined #ocaml
bgs has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
Tuplanolla has joined #ocaml
bgs has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
amk has quit [Ping timeout: 250 seconds]
amk has joined #ocaml
<discocaml> <darrenldl> @kumar I asked around on my university compsci discord, and got a response:
<discocaml> <darrenldl> "For OCaml I'd recommend learning how JS's Async library works, which is very similar to async/await in Python and JavaScript. It uses a single thread with a scheduler that (roughly speaking) loops through all the active async/concurrent functions doing a bit of work in each until they're complete. See https://dev.realworldocaml.org/concurrent-programming.html
<discocaml> <darrenldl>
<discocaml> <darrenldl> If you want to write concurrent code with multithreading, I'd probably recommend learning Rust using the Rust book (https://doc.rust-lang.org/stable/book/) and finding a good tutorial on using standard library's std::sync::{Mutex, Arc} and maybe std::sync::atomic and std::sync::mpsc. The reason I say Rust is because it gives good compiler errors for many types of memory bugs that are common writing concurrent code, so it teaches you best pra
<discocaml> <kumar> I am more of a rust person than a js/python person so thanks for the effort and help. I was using tokio, maybe understanding tokio might help. There is also https://lunatic.solutions/ which is an erlang like runtime unlike tokio which has an async-await syntax
<discocaml> <kumar> I am more of a rust person than a js/python person so thanks for the effort and help. I was using tokio so I'll go forth learning tokio, maybe understanding tokio might help. There is also https://lunatic.solutions/ which is an erlang like runtime unlike tokio which has an async-await syntax
<discocaml> <kumar> and I maybe after effects ocaml would have a different approach to concurrent programming with effects
<discocaml> <kumar> specially after eio
<discocaml> <kumar> But thanks for gathering info and resource! Again really appreciate it
Haudegen has joined #ocaml
<discocaml> <copy> I'd suggest building your own scheduler with the effects manual (https://v2.ocaml.org/manual/effects.html) and Uring (https://github.com/ocaml-multicore/ocaml-uring/blob/main/lib/uring/uring.mli). Both well-documented, and should give you a good idea of a modern scheduler in ~200 lines of code.
<discocaml> <darrenldl> yep it'd a more direct style (no more needing to put everything under `Lwt.t` as soon as you want to make use of one), but the general thinking about async would be similar, and you get preemptive scheduling within a domain (i'm pretty sure...)
John_Ivan has quit [Quit: Phantom of the future.]
spip has joined #ocaml
kurfen has quit [Remote host closed the connection]
kurfen has joined #ocaml
xgqt has quit [Ping timeout: 248 seconds]
xgqt has joined #ocaml
Stumpfenstiel has joined #ocaml
<discocaml> <Anurag> @kumar If you are looking for examples of a simple event loop using the new effect modules in OCaml 5, I have a couple of samples that could be of interest. <https://github.com/anuragsoni/sandbox/tree/main/ocaml/effect_poll> for a single threaded loop, and <https://github.com/anuragsoni/sandbox/tree/main/ocaml/async_io> for a multi-threaded loop.
<discocaml> <Anurag>
<discocaml> <Anurag> These were for educational purposes only, so i'd still look at how Janestreet's async is structured for a more robust production ready async runtime.
azimut has joined #ocaml
bartholin has joined #ocaml
kakadu has quit [Remote host closed the connection]
Exagone313 has joined #ocaml
buoy49_ has joined #ocaml
kurfen_ has joined #ocaml
buoy49 has quit [Ping timeout: 255 seconds]
jsoo has quit [Ping timeout: 255 seconds]
kurfen has quit [Ping timeout: 255 seconds]
Exa has quit [Ping timeout: 255 seconds]
Exagone313 is now known as Exa
jsoo has joined #ocaml
<discocaml> <kumar> @copy implementation of your own scheduler sounds like a cool thing to do. Thanks for the suggestion I might just do it.
<discocaml> <kumar>
<discocaml> <kumar> @BigOof I think lwt_preemptive scheduling is also built on domains.
<discocaml> <kumar>
<discocaml> <kumar> @Anurag both samples look interesting I'll have a look thanks! I've never used async by Janestreet but I can try using it. Async is in the real world ocaml book so it's worth trying
<discocaml> <kumar> Thanks for the suggestions and help 🙏
xd1le has quit [Quit: xd1le]
oriba has joined #ocaml
waleee has joined #ocaml
bartholin has quit [Quit: Leaving]
czy has quit [Remote host closed the connection]
czy has joined #ocaml
czy has quit [Remote host closed the connection]
czy has joined #ocaml
<discocaml> <masterbuilder> is there any way to get information about local variables when debugging ocaml programs using gdb?
Tuplanolla has quit [Quit: Leaving.]
<companion_cube> full support for DWARF is still not there, alas
czy has quit [Remote host closed the connection]
szkl has quit [Quit: Connection closed for inactivity]
<discocaml> <masterbuilder> oh, that's too bad
<discocaml> <masterbuilder> logging it is then