<discocaml>
<romain.beauxis> Hey there! Do y'all know if there's any plan to bring back memprof in ocaml 5.x? Looking at updating some code to be exclusively 5.x and not having any memory tracing ability seems like a hard concession..
<companion_cube>
There's a PR I think
<companion_cube>
Not sure it'll make it to 5.2 but JHJ is reviewing the PR I think
<discocaml>
<romain.beauxis> Doesn't seem to resurect the whole thing but good to see some progress
<discocaml>
<romain.beauxis> Hoo my bad I missed a good chunk looks like it does. Great!
<discocaml>
<romain.beauxis> Thanks, that's enough to be able to wait a little more for the updated version and migrate the app meanwhile!
<discocaml>
<vcool1015> is there a support channel for ocaml? Im having trouble with initializing it. Currently, I have to type eval $(opam env) every single time i need to open utop
<discocaml>
<idontwantausernamefeckoff> what shell are you on
<discocaml>
<vcool1015> um, Im not sure what you mean, but Im on MacOS
<dh`>
shell as in command prompt interpreter
<dh`>
default on macos is zsh
<discocaml>
<vcool1015> ok, then im using zsh
dh` has quit [Read error: Connection reset by peer]
Tuplanolla has quit [Quit: Leaving.]
<discocaml>
<idontwantausernamefeckoff> is anybody using metaocaml? how would you compare it to ppx
<discocaml>
<idontwantausernamefeckoff> not trying to use it in production obviously but metaprogramming is fascinating to me and something closer to rust or lisp macros would be lovely
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
<discocaml>
<_ggole> metaocaml is purely generative, you can't inspect the structure of terms at all (unless you maintain your own ast off to the side or something)
<discocaml>
<_ggole> So it's staging rather than macros
<discocaml>
<vcool1015> I still need help lol
rgrinberg has joined #ocaml
<discocaml>
<idontwantausernamefeckoff> hmm, could you explain this a bit more?
<discocaml>
<_ggole> @vcool1015 usually there's some junk that you put in .bashrc or the equivalent that sets things up for you, so check that exists and looks correct? I dunno what it should look like on your platform, I'm afraid.
<discocaml>
<idontwantausernamefeckoff> in zsh it’s exactly the same, opam even writes it for you
<discocaml>
<_ggole> @idontwantausernamefeckoff well, instead of an S-expression or similar you construct values of type `'a code` and they are simply opaque
<discocaml>
<_ggole> You can run them and print them and that's it
<discocaml>
<_ggole> Whereas CL macros are functions on conses and symbols, you can do all sorts of junk quite directly
chrisz has quit [Ping timeout: 256 seconds]
<discocaml>
<idontwantausernamefeckoff> how does that compare to ppx’s constructing of expressions?
<discocaml>
<_ggole> This is in some ways a disadvantage, and in some ways an advantage. An advantage is that metaocaml expressions are typed (the `'a` in `'a code`)
<discocaml>
<_ggole> The disadvantage is that inspecting code structure can be useful, and if you want to do that you'll have to do various clever things (that I've never played with tbh)
chrisz has joined #ocaml
<companion_cube>
I was hyped for metaocaml a long time ago
<companion_cube>
these days I think it's kind of useless actually
<discocaml>
<_ggole> ppx is a lot like Lisp macros, except the AST is a lot more complex than S-expressions
<companion_cube>
if anything, give me constexpr, not staging
<discocaml>
<_ggole> I think its fine in its niche, but its niche is kinda small
<discocaml>
<_ggole> Things like FFTW
<discocaml>
<idontwantausernamefeckoff> ppx is surprisingly nice to use for me, but i still find myself jealous of rust macros
<companion_cube>
but funnily enough, FFTW is done by emitting C, not OCaml
<companion_cube>
I wish we had rust's non procedural macros for small-scale, easy metaprogramming, say
<discocaml>
<idontwantausernamefeckoff> metaquot gets quite close
<discocaml>
<idontwantausernamefeckoff> honestly i think what i am really jealous of is having them as a first class feature
<discocaml>
<mbacarella> * then turn those ASTs into .ml files when you're done
<discocaml>
<mbacarella> constructing ASTs themselves can be a bit tedious, so you can use the metaquot extension to write ocaml itself and treat that as data
<discocaml>
<mbacarella> it's kind of a bit of work to bootstrap so people frequently just `printf` ocaml code instead 🤣
<companion_cube>
I certainly do…
<companion_cube>
with dune it's not that hard to do codegen
<discocaml>
<mbacarella> yeah, not knocking it. it's effective
<discocaml>
<mbacarella> ocaml: develops entire system for manipulating ASTs
<discocaml>
<mbacarella> devs: eh just printf
<companion_cube>
ocaml: doesn't provide a standard, stable AST representation
<companion_cube>
:p
<discocaml>
<mbacarella> ```ocaml
<discocaml>
<mbacarella> midwit_meme
<discocaml>
<mbacarella> ~tails:"just use printf"
<discocaml>
<mbacarella> ~mid:"Noooo, you can't just 'printf'! You need to leverage OCaml's sophisticated metaprogramming support for code generation. It's far more reliable and type-safe, allowing for compile-time checks and macro-based abstraction. This not only ensures correctness but also significantly enhances the maintainability and scalability of your code. By abstracting repetitive patterns and enforcing type constraints at compile time, we minimize runti
<discocaml>
<mbacarella> ```
<companion_cube>
I'll go further: I've used Format in the past for codegen, but now I tend to use printf (one printf per line) 🙃
rgrinberg has joined #ocaml
<discocaml>
<rgrinberg> the OCaml AST is not all that suited for code gen. Too many irrelevant details exposed for a typical code gen to be concerned about.
<discocaml>
<rgrinberg> I'd also much rather use printf or create my own simplified AST
<discocaml>
<rgrinberg> no point in using `Format`, if you can just `ocamlformat` the generated code anyway
<discocaml>
<idontwantausernamefeckoff> metaquot atm is kind of ineffective. anything dynamic needs to be written through the ast
fweht has joined #ocaml
<companion_cube>
Absolutely, if you have a variable list of match cases, you're back into ast land
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
a51 has quit [Quit: WeeChat 4.2.1]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
a51 has joined #ocaml
dnh has joined #ocaml
chrisz has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duncan has quit [Remote host closed the connection]
duncan has joined #ocaml
<discocaml>
<bluddy5> you're talking about ppx metaquot?
mccd has joined #ocaml
Anarchos has joined #ocaml
mccd has quit [Ping timeout: 256 seconds]
dnaq has quit [Remote host closed the connection]
a51 has quit [Quit: WeeChat 4.2.1]
dnaq has joined #ocaml
jabuxas has quit [Quit: oops :p]
jabuxas has joined #ocaml
jabuxas has quit [Client Quit]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Anarchos>
Is 5.2 out ?
bartholin has quit [Quit: Leaving]
<discocaml>
<lukstafi> Ahh `Lazy.sexp_of_t` forces the thunk...
<discocaml>
<lukstafi> (5.2 is following the regular schedule of being released in April IIRC?)
<discocaml>
<lukstafi> Bad `Lazy.sexp_of_t`, you should check if there's data and only then convert it.
<discocaml>
<lukstafi> For my use case; ok I agree the original behavior is better for other use cases.
* Anarchos
is sad : still no Haiku OS for native compiler in trunk…
dnaq has quit [Remote host closed the connection]
dnaq has joined #ocaml
dnaq has quit [Remote host closed the connection]
<prgbln>
what would be an easy way to figure out which opam packages have the highest number of dependants?