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/
Tuplanolla has quit [Quit: Leaving.]
waleee has quit [Ping timeout: 245 seconds]
xd1le has quit [Quit: xd1le]
<companion_cube> dh`: I don't understand what you want
<companion_cube> Lwt definitely has sub second sleep
<companion_cube> And to get the current time you don't need lwt at all
<dh`> I must have been looking in the wrong place then
<dh`> the documentation for Lwt_timeout says int -> (unit -> unit) -> t
<dh`> and what I'm actually trying to do is tick n times a second
chrisz has quit [Ping timeout: 268 seconds]
chrisz has joined #ocaml
<dh`> (and this is using lwt because of a pile of webgoop that's written on top of it)
<companion_cube> use Lwt_unix.sleep
<dh`> after considering options I used Lwt_preemptive.detach
<companion_cube> just be aware that Lwt_unix.sleep is far more lightweight
<dh`> not significant here :-)
<dh`> already have another Lwt_preemptive.detach because I couldn't get lwt to run a real background thread
<dh`> which was probably because I couldn't figure it out under deadline pressure, not because it can't
edr has quit [Quit: Leaving]
trev has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
szkl has joined #ocaml
bartholin has joined #ocaml
dnaq has quit [Remote host closed the connection]
dnaq has joined #ocaml
Serpent7776 has joined #ocaml
slothby has quit [Quit: brb ... maybe]
bartholin has quit [Quit: Leaving]
dhil has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
xd1le has joined #ocaml
<discocaml> <darrenldl> what do you lot use to manage development environment? (say ocaml compiler + opam packages, and also maybe IDE + lsp)
<discocaml> <darrenldl> just install directly? nix? VM?
<raphaal> opam + emacs
<discocaml> <darrenldl> install directly into user directory? no separation from actual home directory?
<raphaal> yes, but I'm not ocaml power user, so this is fine for me
<raphaal> I have one ocaml version
<discocaml> <darrenldl> do/would you do the same with other langs with (usually) heavier IDE dependencies? e.g. java + intellij
<discocaml> <darrenldl> just working out how much i need to worry about packaging projects up neatly. maybe not very much.
<raphaal> python -> virtualenv, so no, I have environ per project
<discocaml> <darrenldl> gotcha. thanks!
<raphaal> ok, so maybe I have the same question, how to manage different ocaml environments?
Tuplanolla has joined #ocaml
<greenbagels> an unrelated question, to add to the question hour
<discocaml> <darrenldl> raphaal: my (somewhat unsatisfactory) answer so far is to chug everything into podman/docker, since i want the additional separation anyway when working with other people's project (in case it accidentally deletes home, steals ssh keys, etc)
<greenbagels> are there any general rules to how aggressively the ocaml compiler optimizes? for example, if i iterate over a list from front-to-back linearly with List.nth, is it smart enough to make each iteration O(1), or will it still be O(n) per .nth lookup?
<discocaml> <darrenldl> as in between multiple calls to List.nth?
<greenbagels> Yeah
<discocaml> <darrenldl> yeah i don't think it'd cache/memoize the result for you
<discocaml> <darrenldl> my guess is it's not a sound optimisation w.r.t. mutation, secondly is how do you determine if it's likely that the `n` in each run will be same and you should actually cache the result in the general case
<discocaml> <._null._> Without flambda, ocaml optimises quite few things; pretty much only the primitives (equality, comparisons, tail calls and closures) I think. This is part of why it is fast and executable speed is predicatable
<octachron> greenbagels, your List example is a change of your algorithm complexity, you can be nearly certain that the compiler will never do that for you.
<greenbagels> octachron: right because it would basically have to break apart the nth calls and whatnot
<discocaml> <._null._> *This is part of why the compiler is fast and executable speed is predictable
<octachron> compiler optimisations that you can reasonably expects are constant propagations and a limited amount of inlining. Inlining is better with flambda, and this aspect will be improved further with flambda2.
<octachron> But all optimisations currently preserve the semantics of untyped OCaml which impose that it not possible to change the order of side-effects. And with asynchronous exceptions, an allocation is a side-effect.
<octachron> So proably the take away is that the code that you write is mostly the code that is run with the optimisers trying to optimise details that you didn't write like the call stacks, the handling of closure environment, ... .
cimento has quit [Quit: WeeChat 4.1.2]
dhil has quit [Ping timeout: 260 seconds]
cimento has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
cimento has quit [Ping timeout: 255 seconds]
aztex has joined #ocaml
aztex2 has joined #ocaml
aztex has quit [Ping timeout: 250 seconds]
cimento has joined #ocaml
noscript has left #ocaml [#ocaml]
cimento has quit [Quit: WeeChat 4.1.2]
dnh has joined #ocaml
aztex2 has quit [Quit: Client closed]
edr has joined #ocaml
waleee has joined #ocaml
rgrinberg has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
azimut has quit [Ping timeout: 240 seconds]
cimento has joined #ocaml
cimento has quit [Client Quit]
cimento has joined #ocaml
cimento has quit [Client Quit]
<greenbagels> octachron: i see, thanks!
cimento has joined #ocaml
cimento has quit [Quit: WeeChat 4.1.2]
alexherbo2 has joined #ocaml
szkl has joined #ocaml
xd1le has quit [Remote host closed the connection]
xd1le has joined #ocaml
xd1le has quit [Quit: xd1le]
bartholin has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
waleee has joined #ocaml
dhil has joined #ocaml
trev has quit [Quit: trev]
azimut has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> what happens to branch 4.14.2 ? The LTS is 4.14.1...
<discocaml> <undu> Probably preparing the release 4.14.2?
dhil has quit [Ping timeout: 256 seconds]
bartholin has quit [Quit: Leaving]
<octachron> The LTS branch is 4.14. There will be a release of 4.14.2 in the beginning of 2024.
Serpent7776 has quit [Ping timeout: 256 seconds]
dnh_ has joined #ocaml
dnh has quit [Ping timeout: 252 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<dh`> I do have a real lwt question, though. it seems that asserting or generating other exceptions in lwt contexts causes the exceptions to evaporate silently
<dh`> what's the right way to prevent that?
alexherbo2 has quit [Remote host closed the connection]