<Fardale>
One think you can do with Polymorphic variant is subtyping. In your exemple Foo is a subtype of [`Bar | `Baz | `Toto]
<Fardale>
For more difference, you will have to wait for people with more experience with them.
azimut has quit [Ping timeout: 246 seconds]
dh` has quit [Server closed connection]
dh` has joined #ocaml
dnh has joined #ocaml
<discocaml>
<dinosaure> the first advantage of polymorphic variants is that you don't need to express `type t = [ 'Foo | 'Bar ]` to start to use them. You can directly say: `val eval : state -> [ 'Continue | 'Discontinue ]` where, with a simple ADT, you must do `type t = Continue | Discontinue ;; val eval : state -> t`
<discocaml>
<dinosaure> the second advantage is that you can _pattern-match_ a subset of a set of polymorphic variants such as `type rgb = [ 'Red | 'Green | 'Blue ] and color = [ rgb | 'Yellow | 'Magenta ]` and `match color with #rgb as rgb_color -> ... | other_color -> ...`
<discocaml>
<dinosaure> this is why we talk about _sub_-typing. You can manipulate a subset of all possibilities if you want 🙂
<discocaml>
<xavierm02_> Is there some point to splitting a huge program (say a compiler) into many dune libraries (say one par pass)?
<discocaml>
<xavierm02_> Is there some point to splitting a huge program (say a compiler) into many dune libraries (say one per pass)?
ShalokShalom has joined #ocaml
yziquel has joined #ocaml
<discocaml>
<Kali> it is `, not '
<discocaml>
<Kali> you can put ` in inline code by using two instead of one on either side
<discocaml>
<dinosaure> did not know 🙂
<discocaml>
<Kali> `` `Like `This``
<discocaml>
<Kali> ```
<discocaml>
<Kali> `` `Like `This``
<discocaml>
<Kali> ```
ShalokShalom has left #ocaml [#ocaml]
waleee has joined #ocaml
azimut has joined #ocaml
yziquel has quit [Ping timeout: 245 seconds]
<companion_cube>
on 5.0, we currently have no way to measure what takes space in the heap, do we?
<discocaml>
<deepspacejohn> I'm not sure if there's a point beyond just being a way to organize your modules. It makes the build slightly more complex but if you have a lot of modules then it may be worth it?
<companion_cube>
yeah it's pretty useful to split into many dune libraries imho
<companion_cube>
you get better control of public/private stuff, dependencies, and you can keep each library a reasonable size
<discocaml>
<deepspacejohn> oh yeah, those are all good advantages
yziquel has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
bartholin has joined #ocaml
<discocaml>
<xavierm02_> Ok. Thanks!
<companion_cube>
octachron: has anyone seen, with 5.0, situations where htop reports gigabytes of memory used, but GC stats return small major heaps (like, 20MB)?
<companion_cube>
that's in presence of significant C bindings, but these are a library, not mine
<companion_cube>
like, the C objects should be collected, and maybe they're not?
<Fardale>
An other advantage of splitting in libraries using dune is that in the dev profile, dune will not recompile everything just the library that changes and what depends on them.
<discocaml>
<sim642> That also happens within a single library between modules
<octachron>
companion_cube, the GC should still report the memory used by C bindings (if they are recorded correctly)
<companion_cube>
they're not, since it's far too limited for that afaict?
<companion_cube>
I mean, you _can_ speak of the size of a bigarray or such, but nothing more complicated than that, can you?
<discocaml>
<flyinfoxtrot> does ocaml have defined behavior for order of operations here? will it always print `world`?
<octachron>
I don't remember a similar issue, but did you try with 5.1 ?
<octachron>
I am tempted to have a chaos patch to the compiler that randomize such patterns.
<companion_cube>
I'm compiling 5.1 right now :D
<companion_cube>
5.1~rc3, that is
<companion_cube>
octachron: but generally, the C API doesn't allow one to say how big a C value is, except for a fixed int at creation, right?
<octachron>
companion_cube, yes, FFI only allow you to give a size hint to the GC.
<companion_cube>
yeah.
<companion_cube>
so here, the values are Z3 solvers, and they can be arbitrarily big, and grow, etc. :D
<octachron>
Indeed, you are right, the GC cannot report the C heap size.
<companion_cube>
I tried using jemalloc but it doesn't help :/
<companion_cube>
seems to be same on 5.1
<companion_cube>
(I guess statmemprof is supposed to work again, but if it doesn't seen the C memory it won't help)
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
yziquel has quit [Ping timeout: 245 seconds]
<octachron>
statmemprof is planned for 5.2, there are just less bugs in the 5.1 runtime.
<companion_cube>
oooh ok
<companion_cube>
exciting times anyway :)
<octachron>
And I imagine that the same code behaves in 4.14 ?
<companion_cube>
I haven't tested it on 4.14, I'm not sure it compiles (there are some deps on compiler-libs, etc. …)
<octachron>
4.14 or any 4.x version
<companion_cube>
I'll have to try yeah
<companion_cube>
(I don't think compiler-libs changed that much between 4.14 and 5.0…?)
<octachron>
There were no changes at all
<companion_cube>
nice. I might try it later today then, I think my deps are not 5.0-only (not even moonpool!)
<octachron>
(aka 5.0 is probably the favourite release of the merlin and ppxlib team since a ... long time)
yziquel has joined #ocaml
yziquel has quit [Quit: Client closed]
<theblatte>
companion_cube: re: lots of resident memory but small heaps according to the GC, maybe that's due to the fact 5.0 doesn't give back memory when the heap shrinks?
<discocaml>
<leviroth> Oh that’s why my memory usage got worse…
<companion_cube>
theblatte: it can't be only that, because GC stats tell me that the max heap size was 100MB
<companion_cube>
but yeah
yziquel has joined #ocaml
yziquel has quit [Client Quit]
rgrinberg has joined #ocaml
_whitelogger has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yziquel has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
yziquel has quit [Quit: Client closed]
yziquel has joined #ocaml
dh` has quit [Ping timeout: 246 seconds]
dnh has quit [Ping timeout: 246 seconds]
dnh has joined #ocaml
dnh has quit [Client Quit]
yosik has joined #ocaml
yosik has quit [Changing host]
yosik has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
Tuplanolla has joined #ocaml
greenbagels has quit [Ping timeout: 245 seconds]
yziquel has quit [Quit: Client closed]
greenbagels has joined #ocaml
yziquel has joined #ocaml
bartholin has quit [Quit: Leaving]
<discocaml>
<cemerick> @dinosaure I've been reading miou's docs a bunch, and I think it's clicked for me. Do I have it right that if we _quantize_ our long-running, CPU-bound tasks (e.g. maybe each `tick` of a solver), then it should be pretty trivial to parallelize those tasks in a fine-grained way across multiple domains in a way that interrupting/cancelling them sort of falls out of it all quite effortlessly?
<discocaml>
<cemerick> that's the sort of thing I figured I'd end up doing "manually" so to speak, just to be able to interrupt/limit long-running (or runaway) computations; but ofc it'd be so much better to plug into a more purpose-built set of abstractions
yosik has quit [Ping timeout: 255 seconds]
Serpent7776 has quit [Ping timeout: 255 seconds]
<companion_cube>
what does "quantize" mean in this context?
rak has quit [Server closed connection]
rak has joined #ocaml
azimut has quit [Ping timeout: 246 seconds]
yziquel has quit [Quit: Client closed]
yziquel has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]