jmct has quit [Read error: Connection reset by peer]
l1x has quit [Ping timeout: 260 seconds]
strmpnk has quit [Read error: Connection reset by peer]
kevinsjoberg has quit [Read error: Connection reset by peer]
jmct has joined #ocaml
kevinsjoberg has joined #ocaml
strmpnk has joined #ocaml
l1x has joined #ocaml
kristjansson has quit [Ping timeout: 260 seconds]
Haudegen has quit [Ping timeout: 264 seconds]
kristjansson has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
jgjl has joined #ocaml
djellemah has quit [Ping timeout: 240 seconds]
makayla11 has joined #ocaml
vicfred has joined #ocaml
wingsorc has quit [Quit: Leaving]
mfp has quit [Ping timeout: 240 seconds]
<tryte>
I keep studying introductory OCaml and something in this book striked me as odd: (at a point about (recursive) sum types) "recursive definitions are indispensable in any algorithmic language for describing the usual data structures (lists, heaps, trees, graphs, etc)."
<tryte>
"To this end, in Objective Caml type definition is recursive by default, in contrast with value declaration (let)."
<tryte>
why the contrast, though? recursive procedures are equally essential to recursive definitions aren't they? as in, you can't make much use of the latter without the former
makayla11 has quit [Ping timeout: 264 seconds]
reynir has quit [Ping timeout: 240 seconds]
zolk3ri has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
zolk3ri has joined #ocaml
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
narimiran has joined #ocaml
osa1 has joined #ocaml
<d_bot>
<ostera> its refering to the fact that they are by default recursive for types, but opt-in for let bindings
tryte has quit [Remote host closed the connection]
tryte has joined #ocaml
vicfred_ has joined #ocaml
vicfred has quit [Ping timeout: 268 seconds]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
Tuplanolla has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
olle has joined #ocaml
mmohammadi9812 has quit [Ping timeout: 264 seconds]
mmohammadi9812 has joined #ocaml
rwmjones has quit [Ping timeout: 260 seconds]
rwmjones has joined #ocaml
<d_bot>
<Saroupille> Is there a known way to restrict the memory usage of an OCaml program? I would like to force my program to use the SWAP memory. A first idea was to use `ulimit -m` (this is explained here: https://alex.dzyoba.com/blog/restrict-memory/). The current solution is to use `systemd-run --scope -p MemoryLimit=50M` which requires to be sudo. I am looking for something simpler which does not require to be sudo. Any idea? The link I gav
bartholin has joined #ocaml
<Fardale>
For me choosing to use the SWAP or the actual RAM is the job of the OS not the program. One thing that may exist is explicite storage of some data to disk
<Fardale>
The package ancient seems to do this
<d_bot>
<Saroupille> My purpose is to reproduce a bug which happens when the OCaml program starts using SWAP. The thing is we have to wait several days to observe this bug and by limiting the RAM usage, we can reproduce it quite easily.
<d_bot>
<Saroupille> Thanks for the tip, I will have a look at it.
<def>
Do you think the bug comes from the runtime? How does it manifest?
<d_bot>
<Saroupille> The application is using `Lwt` and we observe that the way we count the number of sockets in the application is wrong. We count like `400` sockets open while there are only `10`. We suspect that this is because the promise which decrements the number of sockets is called way too late. We observe this only when the node starts using the SWAP.
<theblatte>
remove a few RAM sticks? :)
<Fardale>
@Saroupille an ad hoc solution is to allocate a lot of data at the beginning to force the swap but then maybe this garbage data will be swap and not what you need
<d_bot>
<Saroupille> ... Good idea! But I want to do that only for one application, not my OS :p
jbrown has joined #ocaml
<d_bot>
<Saroupille> This is a bit sad since it is machine dependent so it is not possible to integrate the test in a CI.
<d_bot>
<Saroupille> Which is what I am looking for actually. I want to write an automatic test that could be run in a CI. Today I can reproduce the problem using `systemd-run` but it rquires sudo rights...
<Fardale>
You just need to get the available amount of ram at the start of your program and then allocate
<Fardale>
Can you controle the ram available through the CI directly ?
<d_bot>
<Saroupille> Ok, you are right but you cannot control if something will be swapped.
<Fardale>
Why do you want to test this in the CI?
<d_bot>
<Saroupille> Regression tests? This also gives a way to test more the application in critic situations.
<d_bot>
<EduardoRFS> using a cgroup you can do that
<d_bot>
<EduardoRFS> also a VM should be trivial too
<d_bot>
<Saroupille> Yes I think I will do that. Too bad that this requires `cgroup` though 😢
<Fardale>
Why is thit "too bad"?
<d_bot>
<Saroupille> Less easy than I expected because it requres to create a `group` on an CI and locally if we wnat to run the test. This still requires sudo rights. But it works.
aaaaaa has quit [Ping timeout: 246 seconds]
<d_bot>
<Saroupille> Thanks everyone 🙂
mxns has joined #ocaml
Haudegen has joined #ocaml
<def>
How come a memory allocator affects the way you count sockets :P ? Are you using finalizer to close sockets?!
mmohammadi9812 has quit [Ping timeout: 264 seconds]
mmohammadi9812 has joined #ocaml
dhil has joined #ocaml
mxns has quit [Ping timeout: 246 seconds]
<d_bot>
<dinosaure> ... `cohttp`?
mmohammadi9812 has quit [Ping timeout: 246 seconds]
mmohammadi9812 has joined #ocaml
bartholin has quit [Quit: Leaving]
mfp has joined #ocaml
vicfred_ has quit [Quit: Leaving]
nullcone has quit [Quit: Connection closed for inactivity]
zolk3ri has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
osa1 has quit [Read error: Connection reset by peer]
FreeBirdLjj has quit [Ping timeout: 260 seconds]
osa1 has joined #ocaml
artymort has quit [Ping timeout: 256 seconds]
dhil has quit [Ping timeout: 264 seconds]
artymort has joined #ocaml
dhil has joined #ocaml
motherfsck has quit [Read error: Connection reset by peer]
motherfsck has joined #ocaml
Anarchos has joined #ocaml
<ruffy_>
Is there a way in OCaml to specify depending on the compiler version which function I want to use in my module? So something like a preprocessor instruction?
motherfsck has quit [Quit: quit]
<hannes>
ruffy_: there's the opam package cppo
motherfsck has joined #ocaml
<Anarchos>
ruffy_ maybe you can execve 'ocamlc -v' and do stuff depending the resulting string
djellemah has joined #ocaml
<d_bot>
<Saroupille> > How come a memory allocator affects the way you count sockets 😛 ? Are you using finalizer to close sockets?!
<d_bot>
<Saroupille> We don't know yet, we observe that when the application using the SWAP the finalizer is not seem to be called at the right time.
<ruffy_>
hannes: Thanks I will have a look
<ruffy_>
Anarchos: Yes, I would like to do that, but during compile time it should switch between a function depending on 'ocamlc -v'
<Anarchos>
my 2 cents : never use preprocessor : codes will never be portable
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<hannes>
another approach is e.g. how https://github.com/mirage/bigarray-compat does it. but tbh, I usually avoid conditional compilations, and just raise the lower bound ;)
<d_bot>
<EduardoRFS> any chance of ocaml getting linear types?
<cemerick>
I just started using it myself in conjunction with ppx_getenv, as I dislike anything cpp-esque
dhil has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #ocaml
<ruffy_>
cemerick: Thanks, I will also have a look at that
mbuf has quit [Quit: Leaving]
<d_bot>
<Drup> @EduardoRFS To paraphrase Facebook couple status: It's Complicated.
<d_bot>
<octachron> I think one can say quite safely that it won't happen any time soon, where soon is OCaml 4 lifetime and probably OCaml 5's one too.
dhil has joined #ocaml
<d_bot>
<EduardoRFS> oh ;/
<companion_cube>
you can also avoid preprocessors by using dune + some scripts to generate code depending on the OCaml version
<ruffy_>
Thanksl that sounds also interesting
<ruffy_>
*Thanks
DanC has quit [Ping timeout: 260 seconds]
DanC has joined #ocaml
mxns has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
osa1 has quit [Quit: osa1]
<cemerick>
I thought to try out Logs, but am getting this oddity: `No implementations provided for the following modules: Logs_fmt referenced from src/foo.cmxa`
<cemerick>
`~/.opam/4.08/lib/logs/logs_fmt.cmx` is sitting right there, so I'm confused
hnOsmium0001 has joined #ocaml
<companion_cube>
you need to link against `Logs_fmt`
<companion_cube>
it's a separate library
<companion_cube>
(forgot if it's logs.fmt or something)
<companion_cube>
well it's optional because it depends on Fmt
<cemerick>
yeah, I saw that, but didn't make the connection that it was a separate library
<cemerick>
vs e.g. containers.data, which is called out as such in the docs
<companion_cube>
welllllll :D
<companion_cube>
nowadays it's containers-data
<cemerick>
I'm still on 2.8 :-P
<companion_cube>
ah, I understand
<companion_cube>
3.0 is nice though ;)
andreas303 has quit [Ping timeout: 240 seconds]
<companion_cube>
(a bit more uniform, a bit friendler with `seq` and printers)
<cemerick>
I've almost done it a couple of times, but I have a lot of stringy printer stuff to "port"
<companion_cube>
yeah I understand
<cemerick>
I'll be bored someday and just pull off the bandaid
<companion_cube>
it can be useful to define helper functions that behave like the old printers, and use that
<companion_cube>
I often have a `pp_list` in my projects that does that
FreeBirdLjj has quit [Remote host closed the connection]
EduardoRFS has joined #ocaml
EduardoRFS has quit [Client Quit]
waleee-cl has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
gareppa has joined #ocaml
andreas303 has joined #ocaml
narimiran has joined #ocaml
gareppa has quit [Ping timeout: 268 seconds]
nullcone has joined #ocaml
tane has joined #ocaml
cbarrett has quit [Read error: Connection reset by peer]
stylewarning has quit [Read error: Connection reset by peer]
cbarrett has joined #ocaml
stylewarning has joined #ocaml
olle has quit [Ping timeout: 268 seconds]
andreas303 has quit [Ping timeout: 240 seconds]
andreas303 has joined #ocaml
motherfsck has joined #ocaml
ransom has quit [Ping timeout: 268 seconds]
Haudegen has quit [Quit: Bin weg.]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
mxns has quit [Ping timeout: 264 seconds]
narimiran has quit [Ping timeout: 264 seconds]
madroach has quit [Quit: leaving]
jca has quit [Quit: leaving]
neiluj has joined #ocaml
neiluj has quit [Changing host]
neiluj has joined #ocaml
Haudegen has joined #ocaml
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
Haudegen has quit [Ping timeout: 264 seconds]
ransom has joined #ocaml
Haudegen has joined #ocaml
berberman_ has joined #ocaml
berberman has quit [Ping timeout: 268 seconds]
aaaaaa has joined #ocaml
mxns has joined #ocaml
raver has quit [Quit: Gateway shutdown]
mxns has quit [Ping timeout: 240 seconds]
<tryte>
@ostera: I understand that, my question was about about the *motivation* for such contrast. I found it hard to wrap my head as to why would you default to recursive data definitions, which will almost always be followed by recursive functions on them, and then don't default to recursive function definitions
motherfsck has quit [Quit: quit]
<d_bot>
<craigfe> tryte: there's a culture around shadowing of let-bindings in OCaml, but shadowing a type is less common. That is probably why the latter is recursive by default and the former is not.
<d_bot>
<craigfe> (something of a chicken-and-egg nature to my argument: what I really mean is that I suspect the authors felt that shadowing let-bindings was valuable, and the community has grown to agree with them)
<tryte>
I see, thanks craigfe, I'll try to see it from that perspective then. I think it can clarify the issue
<companion_cube>
I think that if it was to be redone, we'd have `type rec`.
<tryte>
I think I'm just old and experiencing some mild discomforts by being too used to SML semantics :) I'll eventually succeed in letting go. I actually pretty much like some of the extra niceties in OCaml
<tryte>
Those things go fast when you start to actually write a bit, so it's nothing really
vesper11 has quit [Ping timeout: 240 seconds]
ransom has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has quit [Ping timeout: 258 seconds]
<def>
the recursive types by default is now considered a mistake.
<def>
the nonrec keyword was added as a workaround.
ransom has joined #ocaml
<d_bot>
<oleg_p> does anyone get a similar error while upgrading the lsp-server?
<d_bot>
<oleg_p>
Haudegen has joined #ocaml
<d_bot>
<oleg_p> ```opam
<d_bot>
<oleg_p> #=== ERROR while compiling ocaml-lsp-server.~dev ==============================#