<discocaml>
<softwaresirppi> I get that... But can't we like make an interface and swap the implementation cleverly? The user can mistakenly think he is writing brute force. That's the fantasy?
<discocaml>
<softwaresirppi> Hey guys, As there are Ocaml 99 problems, is there anything else that's comprehensive and useful to solve?
<discocaml>
<softwaresirppi> I'm not just asking about Ocaml, just looking for curated problem lists
<discocaml>
<leviroth> I don't really disagree that doing magic optimizations is good _if you can get it for free_. It's true that it makes it harder to reason about performance, but if you can still reason about _lower bounds_ of performance it's not clear why you should be sad if your performance sometimes unexpectedly exceeds those bounds.
<discocaml>
<leviroth>
<discocaml>
<leviroth> However, I imagine in practice it's hard to get these wins without considerable tradeoffs in complexity. For example, if OCaml silently turned `char list` into an (immutable) array, what happens when you pass the array into `List.map`? `List.map` takes a list, not an array, and the compiled form of that function assumes that the value it receives has the memory structure of a list. So now if you want to be able to support this transformation
toastal has joined #ocaml
nirvdrum has joined #ocaml
<dh`>
irc is _supposed_ to be ephemeral
<dh`>
public channel logging is against the spirit
toastal has quit [Ping timeout: 252 seconds]
<discocaml>
<softwaresirppi> Trade-offs are a very good point. Even the C compiler compiles `x % 2` to a bitwise and. Maybe we should only optimize if it's not going to affect any other behaviour
spew has quit [Quit: good night]
raskol has quit [Ping timeout: 244 seconds]
<discocaml>
<yawaramin> i suppose the CCBot is logging all the IRC messages into Discord history
<dh`>
oh, it is
<dh`>
the bridge wouldn't work otherwise
<dh`>
anyway, as far as freezing lists into arrays, it wouldn't be very hard to compile two versions of List.map and select the proper one at each call site
<dh`>
the problem is knowing which things you need two copies of, and to some extent the bloat generated by unused ones
<dh`>
or alternatively you could pass a sum and unpack it in the callee, but that adds other overhead
<dh`>
and to really sort out when to freeze lists requires a level of intermodule analysis that's difficult to actually do in practice
cr1901_ has joined #ocaml
cr1901 has quit [Read error: Connection reset by peer]
Techcable has quit [Ping timeout: 248 seconds]
Techcable has joined #ocaml
pi3ce has quit [Read error: Connection reset by peer]
pi3ce has joined #ocaml
bartholin has joined #ocaml
<discocaml>
<gooby_clown> dh`: I don't know about its inception, but nowadays I feel like IRC is used like a communication protocol/chat application like any other, and a chat history is an integral part of that. If I join the channel in the middle of a conversation here or somewhere else, I have no idea what is being discussed because I have no history. Even if you really *don't* want history, it would probably be nice to have temporary history, maybe which is del
semarie has quit [Quit: WeeChat 4.4.2]
semarie has joined #ocaml
Serpent7776 has joined #ocaml
<discocaml>
<lukstafi> Would anyone be interested in the following syntax implemented via PPX? `Module_type with types instantiated` (modulo whatever the attribute or extension point is) translates as `Module_type with type t1 = t1 and type ... and type tn = tn`. The types `t1`, ..., `tn` are all the abstract types in `Module_type`.
<discocaml>
<lukstafi> Ah it's not possible to do this via PPX, at least if `Module_type` is in another file...
neiluj has joined #ocaml
bartholin has quit [Quit: Leaving]
<discocaml>
<lukstafi> Is avoiding code duplication worth it if it increases total lines of code? Writing signatures and functor applications is fun but I have creeping doubts...
<discocaml>
<gooby_clown> Like with many things I think it depends on the situation, it's worth it if it reduces room for error, but if it's a question of comfort only, it might be better to just duplicate
raskol has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
euphores has quit [Ping timeout: 265 seconds]
euphores has joined #ocaml
contificate has joined #ocaml
<contificate>
I've got a bit of a niche question. If I was attaching to an OCaml 4 process, is there a simple set of functions I could hook to record pointer promotions?
<discocaml>
<sim642> Pointer promotions?
<contificate>
During a minor collection, the relocated objects will now point to locations in the major heap.
<discocaml>
<sim642> The `Gc.Memprof` API might be the closest thing
<contificate>
Yeah, I've seen this - I'll probably need to see how I could orchestrate it from the outside. It was indeed have a promotion callback.
<discocaml>
<sim642> Looking at the OCaml implementation you can probably find the runtime C functions that it calls to set it up
<discocaml>
<Alistair> I'm dusting off an old OCaml project, and when running the tests I get the following issue:
<discocaml>
<Alistair> ```
<discocaml>
<Alistair> File "test/typing/dune", line 4, characters 1-15:
<discocaml>
<Alistair> 4 | (inline_tests)
<discocaml>
<Alistair> ^^^^^^^^^^^^^^
<discocaml>
<Alistair> Uncaught exception:
<discocaml>
<Alistair>
<discocaml>
<Alistair> (Sys_error
<discocaml>
<Alistair> "/Users/ajob410/projects/dromedary/_build/default/test/typing/test_whitington.ml: No such file or directory")
<discocaml>
<Alistair> ```
<discocaml>
<Alistair> Looks like `inline_tests` no-longer plays nice with Dune's `include_subdirs unqualified`. Has anyone else encountered this?
<contificate>
I think caml_oldify_one could be a decent hook point as well, actually - now that I read roots.c
contificate has quit [Quit: Client closed]
semarie has quit [Quit: zzz]
semarie has joined #ocaml
semarie has quit [Client Quit]
semarie has joined #ocaml
Anarchos has joined #ocaml
semarie has quit [Quit: zzz]
semarie has joined #ocaml
Anarchos has quit [Ping timeout: 252 seconds]
bartholin has joined #ocaml
spew has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
raskol has quit [Ping timeout: 246 seconds]
raskol has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
germ has quit [Ping timeout: 252 seconds]
germ has joined #ocaml
raskol has quit [Ping timeout: 260 seconds]
Everything has joined #ocaml
YuGiOhJCJ has joined #ocaml
Everything has quit [Ping timeout: 252 seconds]
neiluj_ has joined #ocaml
<neiluj_>
Hi! Would it be possible to restrict users outside of a library to pass user-defined implementations of a module type M to a functor taking an M?
<discocaml>
<._null._> You have a functor, a bunch of given implementations and you don't want users to use any other ?
<neiluj_>
yes!
<discocaml>
<._null._> implementations for its input*
Everything has joined #ocaml
<discocaml>
<._null._> Abstract module types ?
<companion_cube>
neiluj_: hack, but you could require the functor argument to contain a value of a type that you don't expose
<companion_cube>
If the module type has to be public, otherwise like._null_. said
<neiluj_>
null: thanks! problem is that would hide the actual functions in the module
<discocaml>
<._null._> How do you do that ? Since the type has to appear in the module type, unless I'm missing something ?
<discocaml>
<._null._> Would `id` on modules be inlined to a noop ?
<discocaml>
<._null._> Time to feature request private module types
Everything has quit [Quit: leaving]
Everything has joined #ocaml
<neiluj_>
companion_cube: good point, and users can use the functor through a function with first-class module arg
Anarchos has joined #ocaml
Serpent7776 has quit [Ping timeout: 255 seconds]
Anarchos has quit [Ping timeout: 252 seconds]
<discocaml>
<mbacarella> anyone find that they write less ocaml ever since chatgpt came out
<discocaml>
<mbacarella> it really reduces the pain of using lesser/stupid languages
<discocaml>
<mbacarella> sure python yeah you got me i messed up the order of these function arguments with obviously different types. good one. gpt4o please fix this for me
<discocaml>
<mbacarella> dear rack of gpus, please make this python code work. thanks
Everything has quit [Quit: leaving]
Tuplanolla has joined #ocaml
<discocaml>
<._null._> When you believe that all code generated by LLMs is either wrong or already available through a Google search, you don't use them for that
<discocaml>
<mbacarella> yeah it's available through a google search but the LLM can copy/paste it in and change the interface to something i expect
neiluj_ has quit [Ping timeout: 248 seconds]
<discocaml>
<mbacarella> i'm never sure what the delta in experience is. a lot of people find them frustrating because they're wrong so much, whereas i find them useful because they're right sometimes
<discocaml>
<._null._> How do you know they're right and not just more subtly wrong ?
<discocaml>
<mbacarella> i kind of paste it into my editor and run it and the web form looks fine and i click submit and the data appears in the database
<discocaml>
<mbacarella> looks good ship it
raskol has joined #ocaml
omniscient has joined #ocaml
<discocaml>
<mbacarella> like the current thing I'm doing
<discocaml>
<mbacarella> I have a dashboard where users edit a template for something. there's a preview that applies a bunch of javascript transforms to the template to show what the template looks like with fake user data
<discocaml>
<mbacarella>
<discocaml>
<mbacarella> but when you go ahead and publish it runs a completely different python-based transform that attempts to do the same thing, server-side. obviously you don't need two of them, so I'm asking gpt4o to modify the current page to use this new /dashboard/template/preview endpoint I provided
<discocaml>
<mbacarella>
<discocaml>
<mbacarella> then I paste the whole web page as it exists now and ask it to fix it
<discocaml>
<mbacarella> and it... worked. first try.
<discocaml>
<mbacarella> it deleted all of the javascript, changed the "onchange" handler to submit to that endpoint and then populate the result in the iframe
<discocaml>
<mbacarella> the only "bug" is that it provided a csrf_token unnecessarily
<discocaml>
<mbacarella> /dashboard/template/preview doesn't change any data so there's no need for a csrf_token. though it's arguably good that it noticed the page had a csrf_token in play and thought to provide it
<discocaml>
<mbacarella> /dashboard/template/preview doesn't change any data so there's no need for a csrf_token. though it's arguably good that it noticed the page had a csrf_token in play and thought to send it
omniscient has quit [Ping timeout: 260 seconds]
<discocaml>
<mbacarella> someone could argue with me and say sure but how hard is it to step line by line through an .html file and delete code you don't need anymore and then shove in this blob in between the script tags?