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/
bastienleonard has quit [Ping timeout: 244 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
rgrinberg has joined #ocaml
nfc has joined #ocaml
rgrinberg has quit [Quit: Textual IRC Client: www.textualapp.com]
<Boarders__> in dune how do I turn off unuxed-value-declaration
<companion_cube> in your library stanza: (flags :standard -w -32)
<Boarders__> thank you!
<Boarders__> I am new to ocaml, I just wasted tons of time because I was getting a type error that went away after I did dune clean and then re-built, I wouldn't expect that is necessary, what is the typical workflow?
<companion_cube> hmm, you shouldn't need to `dune clean`
<companion_cube> I personally keep a tab with `dune build -w` (it watches and recompiles on changes)
<companion_cube> also, LSP is a must have
<Boarders__> ah ok, I am not sure what it was - something about the .mli file changing and that not getting picked up - might be that I have the dune file badly configured
<Boarders__> is the lsp easy to set up in emacs, I have been using tuareg
<companion_cube> idk, I don't use emacs
<Boarders__> fair enough, I must say merlin plus tuareg is already quite nice and better than any tooling I have in haskell
<companion_cube> oh right! merlin is basically the same as ocaml-lsp
<companion_cube> then you have most of the critical tooling I think
raskol has joined #ocaml
brettgilio has quit [Remote host closed the connection]
brettgilio has joined #ocaml
brettgilio has quit [Client Quit]
brettgilio has joined #ocaml
brettgilio has quit [Client Quit]
brettgilio has joined #ocaml
sagax has joined #ocaml
raskol has quit [Ping timeout: 272 seconds]
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
zebrag has quit [Quit: Konversation terminated!]
ansiwen has joined #ocaml
xd1le has joined #ocaml
azimut has quit [Ping timeout: 268 seconds]
sagax has quit [Quit: Konversation terminated!]
mbuf has joined #ocaml
bcw has joined #ocaml
bcw has quit [Client Quit]
bcw has joined #ocaml
Haudegen has joined #ocaml
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp has joined #ocaml
Tuplanolla has joined #ocaml
olle has joined #ocaml
olle has quit [Ping timeout: 272 seconds]
bcw is now known as Serpent7776
dextaa8 is now known as dextaa
wagle has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
wagle has joined #ocaml
adanwan has quit [Write error: Connection reset by peer]
adanwan has joined #ocaml
gopiandcode has joined #ocaml
wingsorc has quit [Ping timeout: 268 seconds]
nd__ has joined #ocaml
Everything has joined #ocaml
bartholin has joined #ocaml
Everything has left #ocaml [#ocaml]
mjacob has quit [Read error: Connection reset by peer]
Serpent7776 has quit [Ping timeout: 244 seconds]
waleee has joined #ocaml
mjacob has joined #ocaml
gopiandcode has quit [Ping timeout: 244 seconds]
gopiandcode has joined #ocaml
gopiandcode has quit [Ping timeout: 272 seconds]
gopiandcode has joined #ocaml
gopiandcode has quit [Ping timeout: 260 seconds]
gopiandcode has joined #ocaml
gopiandcode has quit [Ping timeout: 244 seconds]
Serpent7776 has joined #ocaml
gopiandcode has joined #ocaml
spip has quit [Ping timeout: 240 seconds]
spip has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Serpent7776 has quit [Ping timeout: 255 seconds]
Serpent7776 has joined #ocaml
omegatron has quit [Ping timeout: 276 seconds]
dextaa has quit [Read error: Connection reset by peer]
dextaa has joined #ocaml
dextaa has quit [Read error: Connection reset by peer]
dextaa has joined #ocaml
olle has joined #ocaml
jpds1 is now known as jpds
waleee has quit [Ping timeout: 272 seconds]
<d_bot> <NotFlawffles> I use both neovim and emacs
waleee has joined #ocaml
<d_bot> <dinosaure> I tried to use a long time emacs but I'm too familiar to quit & open files and directly use my shell. And emacs is too slow when you open it (compared to vim)
<haesbaert> dinosaure: some (if not most) jsut have one emacs session and use emacsclient to openfiles+focus
waleee has quit [Ping timeout: 272 seconds]
Haudegen has joined #ocaml
<d_bot> <dinosaure> yeah, I tried that too :/ but I think I'm soo deep with vim (and I switch many times between my server/computer) that I prefer to use a tool which is _"everywhere"_
<d_bot> <dinosaure> in anyway, I learn by constraints to only use vim without any extensions (even `merlin`)
<haesbaert> also, if you use both, you go to hell, just so you know
<haesbaert> at $PREVIOUSJOB people only used vi, not vim
<haesbaert> cause vim was "bloated" :D
<d_bot> <dinosaure> :D, soon `ed`
<d_bot> <dinosaure> and `opam-ed`
<haesbaert> actually, one guy used ed a lot :D
<d_bot> <VPhantom> I have to admit, my current Vim setup is by no means lean. Although at 24MB per instance it still beats my old experiments with VScode by well over an order of magnitude. 😛
<haesbaert> my emacs takes almost 10seconds to boot tbh
<d_bot> <NotFlawffles> on emacs gui version it instantly load but the terminal mode takes forever to load
<d_bot> <NotFlawffles> by the way I'm new to ocaml i know literally nothing about ocaml and I'm interested in it
<d_bot> <NotFlawffles> I'm setting up the environment and tools as the setup introduction tell
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
waleee has joined #ocaml
<d_bot> <darrenldl> emacs boot up is pretty fast by OS standard
<d_bot> <darrenldl> @dinosaure ive found tmux + nvim to be pretty good - cant be arsed to setup merlin and friends similarly, especially when the ocaml toolchain lives in a container
<companion_cube> so you use containers but you don't have LSP? :/
<d_bot> <darrenldl> nop
<d_bot> <darrenldl> i use either utop or the doc
<d_bot> <darrenldl> (i vagurly recall i should switch to down or whatever is newer(?))
<d_bot> <darrenldl> but otherwise just a compiler message in a box somewhere is good enough
<d_bot> <darrenldl> though perhaps lsp within container is easier than thought (vscode does this for user i believe), so perhaps i should revisit my setup
<d_bot> <VPhantom> tmux+vim here, with merlin. It "just works". 🤞
<companion_cube> nvim + terminal tabs + lsp :p
dextaa has quit [Read error: Connection reset by peer]
<d_bot> <darrenldl> i just refuse to do dev work outside of container these days, just in case of dodgy makefile clean that wipes too much, or ssh key stealing packages (usually in other lang granted)
dextaa has joined #ocaml
<companion_cube> hmm interesting
olle has left #ocaml [#ocaml]
<companion_cube> you mount the container into your repo to access your files?
<d_bot> <darrenldl> correct
<d_bot> <darrenldl> git+ssh remains on host
<companion_cube> do you use a custom docker image for that?
<d_bot> <darrenldl> usually build one off one of the opam images
<d_bot> <darrenldl> timere uses <docker.io/ocaml/opam>
<d_bot> <darrenldl> i use an alpine one for one other project for static builds, etc
<d_bot> <darrenldl> did the same for a haskell prover, cause building it once on each machine is just very slow
<companion_cube> that's interesting, I guess…
<companion_cube> do you install dependencies inside the image? or do you build a custom image with dependencies already baked in?
<d_bot> <darrenldl> latter
rgrinberg has joined #ocaml
<d_bot> <darrenldl> tend to just chug the dockerfile into project repo these days
<companion_cube> so you just start by doing a docker build, then you run the image with a local mount, and you exec vim inside?
<d_bot> <darrenldl> vim outside
<d_bot> <darrenldl> dune etc inside
<companion_cube> ah right, your vim doens't need to talk to anything inside… because no LSP
<d_bot> <darrenldl> yep, unless i replicate whatever vscode is doing
<d_bot> <rgrinberg> it's easy to use the lsp inside the containers
<d_bot> <darrenldl> do i just port forward?
<companion_cube> I think it's just stdio based?
<d_bot> <rgrinberg> socat or some such
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
zebrag has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Serpent7776 has quit [Quit: WeeChat 1.9.1]
mro has joined #ocaml
<d_bot> <darrenldl> will have to try it myself later, havent found a very definitive guide yet
<d_bot> <darrenldl> vscode also runs an agent inside container, so that gives it some flexibility in file pathing
nd__ has quit [Ping timeout: 240 seconds]
azimut has joined #ocaml
mro has quit [Quit: Leaving...]
spip has quit [Ping timeout: 255 seconds]
bobo_ has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
nd__ has joined #ocaml
waleee has quit [Quit: WeeChat 3.5]
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
salkin has joined #ocaml
mro has joined #ocaml
Haudegen has joined #ocaml
mro has quit [Remote host closed the connection]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
mbuf has quit [Quit: Leaving]
<d_bot> <darrenldl> (somewhat reminded by the discussion thread on forum): what's the "fallback" or "catch all" representation people use these days for when you want to serialise but the dara lacks a (good) standardised format?
<d_bot> <darrenldl> (not necessarily with ocaml ecosystem)
<d_bot> <darrenldl> s/dara/data/
<reynir> the output when scp'ing an opam repository is fun to watch https://reyn.irish/stuff/opam-repository.png
ns12 has quit [Quit: bye]
romildo has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
olle has joined #ocaml
<companion_cube> I guess the (bad) catch-all is json
xd1le has quit [Quit: xd1le]
<d_bot> <Bluddy> json is indeed the de facto serialization format nowadays, in just about any language
<d_bot> <Bluddy> sexp is probably the ocaml favorite due to its higher efficiency and dune's usage of it
<d_bot> <jumpnbrownweasel> in 5 or 10 years json will be on its way out, just like xml, and I'll be smiling
mro has joined #ocaml
mro has quit [Ping timeout: 260 seconds]
romildo has quit [Quit: Leaving]
rgrinberg has joined #ocaml
<companion_cube> I doubt that, what would be the replacement?
<d_bot> <Et7f3 (@me on reply)> yaml gain in popularity
<companion_cube> idk if people would favor yaml to json _for serialization_
<companion_cube> for a start, I don't see javascript becoming less popular, and it has JSON as its natural format
<d_bot> <Et7f3 (@me on reply)> for serialization bson might compete
<d_bot> <Et7f3 (@me on reply)> like http1 and 2 is textual why http3 is binary
<companion_cube> but there's no BSON module in javascript.
<companion_cube> (and besides it's the weird one, right? it's super bad compared to CBOR or msgpack)
<companion_cube> I wouldn't mind seeing CBOR becoming a lot more popular, but I don't think it's going to happen
<d_bot> <Bluddy> Question: which is more efficient in ocaml: consider the problem of a simulation running many steps. sometimes, mutable members of a record are updated functionally (i.e. reallocated). is it more efficient to
<d_bot> <Bluddy> a. Always update the mutable elements of the record, whether the member is changed or not
<d_bot> <Bluddy> b. Use a pointer test (==) to check if the element was reallocated, and only update when it was
<d_bot> <Et7f3 (@me on reply)> msgpack is retro compatible ?
<d_bot> <Bluddy> Consider also that most steps in the simulation will have the member remain identical (i.e. not reallocated).
<companion_cube> @Et7f3: what do you mean exactly by retro compatible?
<companion_cube> @Bluddy == is super cheap
<d_bot> <jumpnbrownweasel> well, something new! i'm only saying that formats seem to all have a very limited lifetime
<companion_cube> idk, xml has had its time for a while, and json has been the "standard" for > 10y at this point
<companion_cube> and there's no obvious replacement
<d_bot> <jumpnbrownweasel> at one point it seemed certain that asn.1 would be the final one
<companion_cube> did it? I thought it was really only a thing for crypto
<d_bot> <Bluddy> Is it worthwhile to use == to avoid the write barrier costs?
<companion_cube> it can be I think
<d_bot> <Bluddy> the alternative is to hit the write barrier every step
<companion_cube> if == should be a handful of instructions at most
<d_bot> <Bluddy> if so, this could be an important pattern for efficient applications
<d_bot> <NULL> Especially a `if (==) then return` should be just two ?
<companion_cube> @Bluddy tbh, maybe the most efficient way is to use struct-of-bigarrays :p
<companion_cube> (inconvenient but well)
<d_bot> <Bluddy> nah I need ocaml values
<d_bot> <jumpnbrownweasel> i thought the write barrier was only for mutation, but you said you're reallocating? anyway, not allocating is always good for frequent operations
<d_bot> <Bluddy> yes I'm mutating a member of a record, that happens to be immutable
<d_bot> <Bluddy> the member is updated rarely, but the outer record is updated frequently
bartholin has quit [Quit: Leaving]
<d_bot> <Bluddy> on godbolt, it does look like the effect of the comparison is minor: essentially a compare and jump
<d_bot> <Bluddy> vs. calling caml_modify at each step
<d_bot> <Bluddy> so I think this is my new pattern
<d_bot> <rgrinberg> Can you make your fields immediates? That would give you the best of both of worlds
* dh` sighs
<dh`> oops, wrong window
<companion_cube> I just wish the story of rust bindings was better
<companion_cube> rust makes it easier to write certain kinds of high-perf code
<companion_cube> (but of course OCaml is more convenient overall…)
waleee has joined #ocaml
<d_bot> <jumpnbrownweasel> This is something i had a question about. In Real World OCaml there is a benchmark showing that mutation of immediate fields is slower than reallocating the record due to the write barrier, and I didn't understand why since I thought immediate fields wouldn't have a write barrier:
<d_bot> <jumpnbrownweasel> under: The Mutable Write Barrier
<d_bot> <jumpnbrownweasel>
<d_bot> <jumpnbrownweasel> Perhaps this is outdated? Or are fields like int and float only treated as immediate if annotated as immediate?
<d_bot> <jumpnbrownweasel> Oh wait, float is not immediate, that must be it.
<d_bot> <rgrinberg> when did floats become immediate?
<d_bot> <jumpnbrownweasel> you're right
rgrinberg has quit [Ping timeout: 244 seconds]
<d_bot> <rgrinberg> companion_cube, where did the zig go?
<companion_cube> zig is cool too, don't worry
<d_bot> <rgrinberg> but more seriously, what's wrong with writing rust bindings today?
<companion_cube> but rust is prod ready
<d_bot> <rgrinberg> i thought there was a lib from ahrefs for making it easy
<companion_cube> hmm, what's the proposed thing to write rust bindings?! the existing one is unsound, and I think Laurent Mazare is writing a new one
<companion_cube> sure, but the core bindings library it relies on is not always correct
<companion_cube> it's been through a lot of work and my understanding is that it's still not entirely stable
<companion_cube> (and besides, you have to juggle unholy things to have it work inside dune and opam)
<companion_cube> (because cargo wants network access, etc.)
<d_bot> <rgrinberg> Laurent Mazare's janestreet effort?
<d_bot> <rgrinberg> AFAIK there's people working on it at ahrefs and tezos. I guess jst as well?
rgrinberg has joined #ocaml
<companion_cube> I didn't know people at ahrefs were working actively on it
<companion_cube> afaik it's been years
<companion_cube> but anyway, besides that, juggling cargo vendor + writing stubs is just not nice, at least it wasn't a few years ago :/
<d_bot> <rgrinberg> you've seen this? https://github.com/tezedge/ocaml-interop
<d_bot> <rgrinberg> I'd like to see improve the {cargo,cmake} + dune story but I'm not entirely sure what's the way to go
<companion_cube> hmm I haven't looked into that one
<companion_cube> only ocaml-rs
<companion_cube> thanks for the pointer
<d_bot> <Anurag> <https://github.com/LaurentMazare/ocaml-rust> looks interesting as well!
<sim642> Obviously the solution is to invent a new meta build tool that juggles dune and cmake
<companion_cube> it'd be neat to have dune be able to directly call cargo to build a `cdylib` crate, but even then it's a pain
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
nd__ has quit [Ping timeout: 255 seconds]
Haudegen has joined #ocaml
<d_bot> <Bluddy> No, the state is quite complicated with records of records, each representing different parts. For performance, the frequently modified stuff (e.g. every cycle) is mutable, while the rarely-modified stuff is immutable.
szkl has quit [Quit: Connection closed for inactivity]
nd__ has joined #ocaml
dextaa has quit [Read error: Connection reset by peer]
dextaa has joined #ocaml
salkin has quit [Quit: salkin]
olle has quit [Ping timeout: 255 seconds]
wingsorc has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]