companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
raskol has quit [Ping timeout: 260 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
raskol has joined #ocaml
ygrek has joined #ocaml
spew has quit [Quit: spew]
myrkraverk_ is now known as myrkraverk
softmoth has quit [Read error: Connection reset by peer]
softmoth has joined #ocaml
kowalk has joined #ocaml
kowalk has quit [Quit: leaving]
kowalk has joined #ocaml
kowalk has quit [Quit: leaving]
kowalk has joined #ocaml
kowalk has left #ocaml [#ocaml]
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
ygrek has quit [Remote host closed the connection]
raskol has quit [Ping timeout: 252 seconds]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 252 seconds]
softmoth has quit [Ping timeout: 252 seconds]
toastal has joined #ocaml
bartholin has joined #ocaml
Serpent7776 has joined #ocaml
<discocaml> <emiletrotignon> Because you put extra parenthesis wherever you have a doubt about priority, and then ocamlformat tells you which were necessary and which were not.
<discocaml> <darrenldl> but i still need to know about priority when i'm reading it again later though
<discocaml> <emiletrotignon> Thats a fair point. The idea I had is for cases where seeing it once or twice is enough to teach you.
<discocaml> <darrenldl> i don't disagree it is a good learning experience, just i really don't have the headspace to remember these things, and i still largely see it as removing my attempt at code clarity
<discocaml> <darrenldl> like you can get away without many parenthesis in a gigantic mathematical formula, but i would appreciate grouping terms with parenthesis as a reader even though they are technically extraneous
<discocaml> <emiletrotignon> ocamlformat does keep some extra parenthesis, its just quite hard to make it perfect because whether they are desirable depends a lot on context. I had math formulas in mind though.
toastal has left #ocaml [Error from remote client]
<discocaml> <darrenldl> i'll gladly take an option to just remove the decision and keep everything for me still: i really don't care about the precedence ranking between `*>`, `<*`, `<|>`, `|>` and a some other random operators
<discocaml> <darrenldl> care about learning*
<discocaml> <emiletrotignon> Yeah its just very hard because of how the current codebase is structured. I tried to add parenthesis information in the datastructure we use for printing. This would allow what you advocate. Alas I did not succeed, it was quite hard for multiple reasons (one of them was that ocamlformat changes some concrete syntax which in some cases results in needing to add parenthesis). Currently, ocamlformat forgets all parenthesis from the input
<discocaml> <darrenldl> fair enough, looks much easier to just normalise AST to one without extraneous parenthesis
<discocaml> <darrenldl> ultimately not every user experience improvement is worth the engineering effort
chiselfuse has quit [Read error: Connection reset by peer]
torretto has quit [Read error: Connection reset by peer]
torretto has joined #ocaml
chiselfuse has joined #ocaml
pi3ce_ has joined #ocaml
pi3ce has quit [Read error: Connection reset by peer]
bartholin has quit [Quit: Leaving]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #ocaml
alexherbo2 has joined #ocaml
euphores has quit [Quit: Leaving.]
<discocaml> <getzapped.> can i bind a type variable on the right side of a type definition? like
<discocaml> <getzapped.>
<discocaml> <getzapped.> ```ocaml
<discocaml> <getzapped.> type t = {compare : 'a -> 'a -> int; inner : 'a other_t}
<discocaml> <getzapped.> ```
euphores has joined #ocaml
<discocaml> <octachron> Yes, but it is probably not what you want.
<discocaml> <octachron> `type 'a t = { compare: 'a -> 'a -> int }` means a record of type `'a t` contains a compare function for `'a`.
<discocaml> <octachron> `type t = { compare: 'a. 'a -> 'a -> int }` means a record of type `t` contains a single compare function that works on any `'a`
<discocaml> <octachron> (there are no such function within the language)
<discocaml> <octachron> `type t = Any: { compare: 'a -> 'a -> int }` means a value of type t contains a `compare` for some unknown type `'a`.
<discocaml> <octachron> (there are many such functions, but it not possible to use any of them once boxed inside the `Any` constructor)
softmoth has joined #ocaml
Haudegen has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
Haudegen has quit [Client Quit]
semarie has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
keyboard has quit [Quit: keyboard]
keyboard has joined #ocaml
keyboard has quit [Remote host closed the connection]
salkin has joined #ocaml
semarie has joined #ocaml
toastal has joined #ocaml
raskol has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
ygrek has joined #ocaml
raskol has quit [Ping timeout: 255 seconds]
<discocaml> <getzapped.> my record also contains another field inner of 'a other_t. I want to store the compare function with the value so that i can pass it to compare_other_t, which is
<discocaml> <getzapped.> ('a -> 'a -> int) -> 'a other_t -> 'a other_t -> int
<discocaml> <getzapped.> i need the 'a of the compare to be the same 'a as 'a other_t, but i want to be able to store these values in a collection where the 'a for each record might be different
<discocaml> <getzapped.> i know what it does, i do not want a polymorphic compare, i want a compare stored with a value of its 'a in a record
<discocaml> <octachron> The third option might work in this case if knowing that the `'a` of compare and the one in `'a other_t` are the same is sufficient.
<discocaml> <deepspacejohn> if you need to store a type inside a record, then that might be a use case for first class modules.
<discocaml> <getzapped.> i am considering it, but is there much overhead with a packed module with a simulated "this" value inside of it over a record with a function and a value of a locally bound type?
<discocaml> <deepspacejohn> at runtime, no. the syntax and error messages can potentially get bigger though.
<discocaml> <octachron> For just a type, the GADT(+unboxing annotation) variant is likely to be lighter than first-class module in term of syntax.
<discocaml> <octachron> But both options are exactly the same at runtime.
jiquiame has left #ocaml [WeeChat 4.2.2]
pi3ce_ has quit [Read error: Connection reset by peer]
pi3ce has joined #ocaml
raskol has joined #ocaml
raskol has quit [Client Quit]
ygrek has quit [Remote host closed the connection]
Serpent7776 has quit [Ping timeout: 252 seconds]
eilvelia has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
spew has joined #ocaml
pi3ce has quit [Ping timeout: 252 seconds]
pi3ce has joined #ocaml
ygrek has joined #ocaml
<discocaml> <yawaramin> let-bindings work even better
<discocaml> <yawaramin> for your use case
<discocaml> <yawaramin> break up parts of the expression into named bindings
Haudegen has joined #ocaml
Anarchos has joined #ocaml
bartholin has joined #ocaml
toastal has quit [Quit: Gateway shutdown]
kowalk_ has joined #ocaml
pi3ce has quit [Read error: Connection reset by peer]
pi3ce_ has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
softmoth has quit [Ping timeout: 260 seconds]
olle__ has joined #ocaml
olle__ has quit [Ping timeout: 252 seconds]
eilvelia has quit [Quit: eilvelia]
Tuplanolla has joined #ocaml
bartholin has quit [Ping timeout: 252 seconds]
bartholin has joined #ocaml
bartholin has quit [Quit: Leaving]
ygrek has quit [Remote host closed the connection]
softmoth has joined #ocaml
<discocaml> <uberpyro181> Hi, if I have a dune project I was wondering what the easiest way to create a "release build" would be
<discocaml> <uberpyro181> e.g. maybe compiling with Flambda, or anything else to improve performance
<discocaml> <uberpyro181> my application isn't performance critical so it's not that important, but since i'm distributing an executable it seemed like it might be the best thing to do
<discocaml> <eval.apply> `dune build --profile release` and and compiler flags with https://dune.readthedocs.io/en/latest/concepts/ocaml-flags.html
<companion_cube> With -p it's always a release build, or use `--profile=release` iirc
Tuplanolla has quit [Quit: Leaving.]