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/
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 265 seconds]
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
malte has quit [Ping timeout: 260 seconds]
malte has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Haudegen has quit [Quit: Bin weg.]
anpad has joined #ocaml
alfiee has joined #ocaml
pi3ce has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
dh` has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
casastorta has quit [Remote host closed the connection]
casastorta has joined #ocaml
malte has quit [Read error: Connection reset by peer]
malte has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
<tetrislife> Just curious. Why don't caching implementations be pessimistic? All threads that don't find it in the cache compute it redundantly, but queries will start succeeding once one of them updates the cache.
<tetrislife> String interning seems to be more constrained, since it returns deduplicated IDs and can't be computed in the threads. Maybe also have thread-local IDs initially pointing to local string copies and later pointing to interned strings.
kron has quit [Quit: kron]
kron has joined #ocaml
<discocaml> <passerby0296> Hello everyone. Here's a piece of my code
<discocaml> <passerby0296>
<discocaml> <passerby0296> | LLTuple [ elem1; elem2 ] ->
<discocaml> <passerby0296> anf_expr env elem1 (fun imm1 ->
<discocaml> <passerby0296> anf_expr env elem2 (fun imm2 ->
<discocaml> <passerby0296> let* var = gen_var "tuple_" env in
<discocaml> <passerby0296> expr_with_imm_hole (ImmIdentifier var)
<discocaml> <passerby0296> >>= fun _ -> return (ACExpr (CTuple [ imm1; imm2 ]))))
<discocaml> <passerby0296>
<discocaml> <passerby0296> Is it possible to generalize it to an arbitrary amount of elements, i.e. write an implementation for match case "LLTuple elements" . Kind of hard to wrap my hand around CPS.
<discocaml> <passerby0296>
<discocaml> <passerby0296> If you need more context, ask!
<discocaml> <passerby0296> Hello everyone. Here's a piece of my code
<discocaml> <passerby0296>
<discocaml> <passerby0296> ```
<discocaml> <passerby0296> | LLTuple [ elem1; elem2 ] ->
<discocaml> <passerby0296> anf_expr env elem1 (fun imm1 ->
<discocaml> <passerby0296> anf_expr env elem2 (fun imm2 ->
<discocaml> <passerby0296> let* var = gen_var "tuple_" env in
<discocaml> <passerby0296> expr_with_imm_hole (ImmIdentifier var)
<discocaml> <passerby0296> >>= fun _ -> return (ACExpr (CTuple [ imm1; imm2 ]))))
<discocaml> <passerby0296> ```
<discocaml> <passerby0296>
<discocaml> <passerby0296> Is it possible to generalize it to an arbitrary amount of elements, i.e. write an implementation for match case "LLTuple elements" . Kind of hard to wrap my hand around CPS.
<discocaml> <passerby0296>
<discocaml> <passerby0296> Here's the closests I've come to
<discocaml> <passerby0296>
<discocaml> <passerby0296> ```
<discocaml> <passerby0296> | LLTuple elems ->
<discocaml> <passerby0296> let rec process_elems env elems acc =
<discocaml> <passerby0296> match elems with
<discocaml> <passerby0296> | [] -> return (List.rev acc)
<discocaml> <passerby0296> | hd :: tl -> anf_expr env hd (fun imm -> process_elems env tl (imm :: acc))
<discocaml> <passerby0296> in
<discocaml> <passerby0296> process_elems env elems []
<discocaml> <passerby0296> >>= fun imm_elems ->
<discocaml> <passerby0296> let* var = gen_var "tuple_" env in
<discocaml> <passerby0296> expr_with_imm_hole (ImmIdentifier var) >>= fun _ -> return (ACExpr (CTuple imm_elems))
<discocaml> <passerby0296> ```
<discocaml> <passerby0296>
<discocaml> <passerby0296> But it says "this function application is partial,
<discocaml> <passerby0296> maybe some arguments are missing." for `anf_expr env hd (fun imm -> process_elems env tl (imm :: acc))`
<discocaml> <passerby0296>
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
Inline has quit [Ping timeout: 244 seconds]
ygrek has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
mal`` has quit [Quit: Leaving]
ygrek has quit [Remote host closed the connection]
pi3ce has quit [Quit: No Ping reply in 180 seconds.]
pi3ce has joined #ocaml
mal`` has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
agentcasey_ has quit [Quit: ZNC 1.10.x-git-27-bfd731cf - https://znc.in]
agentcasey_ has joined #ocaml
bibi_ has quit [Ping timeout: 245 seconds]
alfiee has joined #ocaml
bibi_ has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
agentcasey_ has quit [Read error: Connection reset by peer]
agentcasey_ has joined #ocaml
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
anpad has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 248 seconds]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
Serpent7776 has joined #ocaml
gentauro has quit [Read error: Connection reset by peer]
alfiee has joined #ocaml
gentauro has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
y331 has joined #ocaml
ds-ac1 has quit [Ping timeout: 272 seconds]
olle has joined #ocaml
Haudegen has joined #ocaml
alfiee has joined #ocaml
bartholin has joined #ocaml
alfiee has quit [Ping timeout: 265 seconds]
ds-ac1 has joined #ocaml
bartholin has quit [Quit: Leaving]
<discocaml> <octachron> The issue is probably `return (List.rev acc)` which is leaking the `imm` variable outside of the context of the `anf_expr` call, you want to call a continuation here.
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 248 seconds]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 248 seconds]
mange has quit [Remote host closed the connection]
agentcasey_ has quit [Ping timeout: 248 seconds]
Haudegen has quit [Quit: Bin weg.]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
agentcasey_ has joined #ocaml
agentcasey_ has quit [Ping timeout: 248 seconds]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
y331 has quit [Ping timeout: 260 seconds]
agentcasey_ has joined #ocaml
Haudegen has joined #ocaml
Inline has joined #ocaml
boozec has joined #ocaml
boozec has quit [Client Quit]
boozec has joined #ocaml
boozec has quit [Client Quit]
spynx has joined #ocaml
spynxic has quit [Read error: Connection reset by peer]
boozec has joined #ocaml
boozec has quit [Client Quit]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 246 seconds]
agentcasey_ has quit [Remote host closed the connection]
<discocaml> <_4ad> tetrislife: if you do string interning for performance (caching), you can do something like that. in my case the algorithm requires that failure in physical equality implies the strings are different.
<discocaml> <_4ad> and I can't change the algorithm really, because it relies on doing only atomic instructions. so something a pointer size must fully determine a string.
mbuf has joined #ocaml
terrorjack45 has quit [Ping timeout: 265 seconds]
agentcasey has quit [Quit: ZNC 1.10.x-git-27-bfd731cf - https://znc.in]
<discocaml> <purringhutao> I'm having some issues with ocamlmklib. When do I need to pass -cclib? -cclib means that when executables are linked to the library, the C library flags are passed along, right?
<discocaml> <octachron> First question, why are you using ocamlmklib?
<discocaml> <purringhutao> I'm trying to modify the CMakeFiles in LLVM, which use ocamlmklib for building the OCaml bindings
alfiee has joined #ocaml
<discocaml> <purringhutao> But I arrived at an issue where I can't get the C++ standard library linked in properly no matter what I do
mbuf has left #ocaml [Leaving]
alfiee has quit [Ping timeout: 245 seconds]
<discocaml> <octachron> As far as I can see, you don't need `-cclib` at all with ocamlmklib. Using `-l<lib>` flag is enough.
<discocaml> <octachron> But yes `-cclib` and `-ccopt` options are recorded inside the cma/cmxa files.
pi3ce has quit [Read error: Connection reset by peer]
pi3ce has joined #ocaml
<discocaml> <purringhutao> https://github.com/ocaml/ocaml/blob/trunk/tools/ocamlmklib.ml Hmm, -cclib in ocamlmkopt is not the same as -cclib in ocamlc/ocamlopt
<discocaml> <purringhutao> https://github.com/ocaml/ocaml/blob/trunk/tools/ocamlmklib.ml Hmm, -cclib in ocamlmklib is not the same as -cclib in ocamlc/ocamlopt
<discocaml> <octachron> No they are the same? The code that you linked is merely collecting the arguments before sending them to ocamlc/ocamlopt.
<discocaml> <purringhutao> Okay, I misread. There's c_libs and caml_libs, but both get the -cclib prefixed
<discocaml> <purringhutao> Is there anything functionally different between -lfoo and -cclib -lfoo for ocamlmklib?
<discocaml> <purringhutao> For some reason, the CMakeFile is giving different build output depending on whether I add -cclib
<discocaml> <purringhutao> Even though the flag `-lstdc++` is passed, I get errors that look like `.text._ZN4llvm10DataLayout5clearEv+0xe6): undefined reference to operator delete(void*)`
<discocaml> <purringhutao> When building the final executable
<discocaml> <purringhutao> https://github.com/Z3Prover/z3/pull/4468
<discocaml> <purringhutao>
<discocaml> <purringhutao> > The patch itself is rather small. First of all, we have to use
<discocaml> <purringhutao> > -l<lib> instead of -cclib -l<lib> in ocamlmklib since the latter
<discocaml> <purringhutao> > will pass the options only to the ocaml{c,opt} linker and will not
<discocaml> <purringhutao> > use the passed libraries when shared and non-shared versions of the
<discocaml> <purringhutao> > bindings are built (libz3ml.a and dllz3ml.so). They were both missing
<discocaml> <purringhutao> > either z3 code itself and ldd entries for stdc++ (and z3 if built not
<discocaml> <purringhutao> > in --staticlib mode).
<discocaml> <purringhutao>
<discocaml> <purringhutao> What does this mean?
terrorjack45 has joined #ocaml
terrorjack45 is now known as terrorjack
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
<discocaml> <purringhutao> No, I was right the first time. This is what the code is:
user_ has joined #ocaml
<discocaml> <purringhutao>
<discocaml> <purringhutao> ```ocaml
<discocaml> <purringhutao> else if s = "-cclib" then
<discocaml> <purringhutao> caml_libs := next_arg s :: "-cclib" :: !caml_libs
<discocaml> <purringhutao> else if s = "-ccopt" then
<discocaml> <purringhutao> caml_opts := next_arg s :: "-ccopt" :: !caml_opts
<discocaml> <purringhutao> else if s = "-custom" then
<discocaml> <purringhutao> dynlink := false
<discocaml> <purringhutao> else if s = "-I" then
<discocaml> <purringhutao> caml_opts := next_arg s :: "-I" :: !caml_opts
<discocaml> <purringhutao> else if s = "-failsafe" then
<discocaml> <purringhutao> failsafe := true
<discocaml> <purringhutao> else if s = "-g" then
<discocaml> <purringhutao> debug := true
<discocaml> <purringhutao> else if s = "-h" || s = "-help" || s = "--help" then
<discocaml> <purringhutao> raise (Bad_argument "")
<discocaml> <purringhutao> else if s = "-ldopt" then
<discocaml> <purringhutao> ld_opts := next_arg s :: !ld_opts
<discocaml> <purringhutao> else if s = "-linkall" then
<discocaml> <purringhutao> caml_opts := s :: !caml_opts
<discocaml> <purringhutao> else if starts_with s "-l" then
<discocaml> <purringhutao> let s =
<discocaml> <purringhutao> if Config.ccomp_type = "msvc" then
<discocaml> <purringhutao> String.sub s 2 (String.length s - 2) ^ ".lib"
<discocaml> <purringhutao> else
<discocaml> <purringhutao> s
<discocaml> <purringhutao> in
<discocaml> <purringhutao> c_libs := s :: !c_libs
<discocaml> <purringhutao> ```
<discocaml> <purringhutao>
ygrek has quit [Ping timeout: 264 seconds]
fmira has quit [Ping timeout: 264 seconds]
<discocaml> <purringhutao> Wait, nevermind, the c_libs get prefixed with -cclib later in the code
<discocaml> <purringhutao> `(String.concat " " (prefix_list "-cclib " !c_libs))`
<discocaml> <purringhutao> I have trouble understanding when to use -cclib when using ocamlmklib, but adding it or leaving it out gives different results
ygrek has joined #ocaml
alfiee has joined #ocaml
<discocaml> <contificate> @passerby0296 A nice way to solve the problem of ANF-converting an arbitrary number of things (a list), when the normalisation routine is in CPS, is to fold a closure. E.g. you begin with an initial value `value list -> anf` whose body creates the normalised ANF tuple (using the `k` from the outside). Then, you fold each expression (of the tuple) into it and the accumulate a closure. Each intermediary closure converts one element and then
alfiee has quit [Ping timeout: 252 seconds]
<discocaml> <contificate> Seems you've done that - sorry, I only glanced over the code initially.
keyboard has quit [Quit: keyboard]
Haudegen has quit [Quit: Bin weg.]
alfiee has joined #ocaml
olle has quit [Ping timeout: 272 seconds]
alfiee has quit [Ping timeout: 260 seconds]
f[x] has joined #ocaml
alfiee has joined #ocaml
ygrek has quit [Remote host closed the connection]
user_ has quit [Remote host closed the connection]
fmira has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
agentcasey has joined #ocaml
Serpent7776 has quit [Ping timeout: 248 seconds]
agentcasey has quit [Read error: Connection reset by peer]
keyboard has joined #ocaml
end has quit [Ping timeout: 246 seconds]
Haudegen has joined #ocaml
agentcasey has joined #ocaml
bcksl has quit [Ping timeout: 265 seconds]
Absalom has quit [Ping timeout: 252 seconds]
agentcasey has quit [Read error: Connection reset by peer]
agentcasey has joined #ocaml
copy has quit []
copy5 is now known as copy
agentcasey_ has joined #ocaml
agentcasey has quit [Ping timeout: 272 seconds]
bcksl has joined #ocaml
end has joined #ocaml
alfiee has joined #ocaml
agentcasey_ has quit [Ping timeout: 245 seconds]
agentcasey has joined #ocaml
alfiee has quit [Ping timeout: 272 seconds]
agentcasey has quit [Read error: Connection reset by peer]
agentcasey has joined #ocaml
bartholin has joined #ocaml
_alix has quit [Ping timeout: 260 seconds]
whereiseveryone has quit [Ping timeout: 260 seconds]
_alix has joined #ocaml
GreaseMonkey has quit [Ping timeout: 260 seconds]
greaser|q has joined #ocaml
whereiseveryone has joined #ocaml
greaser|q has quit [Changing host]
greaser|q has joined #ocaml
greaser|q is now known as GreaseMonkey
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
Anarchos has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 246 seconds]
<discocaml> <gooby_diatonic> How can I get the `Location` module from `Compiler_libs` available in a dune-built project? Ignoring the fact I maybe shouldn't use it in the first place
<discocaml> <gooby_diatonic> In utop it works with `#load "compiler-libs/ocamlcommon.cma";;` but can't seem to get it to work with dune, despite trying with `(libraries compiler-libs)` and `(libraries compiler-libs.common)`
<discocaml> <octachron> `(libraries compiler-libs.common)` should work . What issues are you observing?
alfiee has joined #ocaml
<discocaml> <gooby_diatonic> The module just isn't found, `Error: Unbound module Compiler_libs`. Now, I realised that maybe the library just makes the module `Location` available bare, without the `Compiler_libs` wrapper, in which case the issue for me was that ppxlib's `Location` was shadowing it
<discocaml> <octachron> The compiler-libs are not wrapped.
<discocaml> <octachron> And you should not mix the vanilla compiler-libs with ppxlib
<discocaml> <octachron> (too many rooms for mistakes)
<discocaml> <gooby_diatonic> I realised that ppxlib provides their own `Location.print` which I think works for my scenario, but it's good to know about compiler libs for the future 🙏 Thanks for the answer
alfiee has quit [Ping timeout: 252 seconds]
y331 has joined #ocaml
y331 has quit [Client Quit]
Inline has quit [Quit: Leaving]
f[x] has quit [Remote host closed the connection]
Serpent7776 has joined #ocaml
Inline has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 248 seconds]
rgrinberg has joined #ocaml
spynx is now known as spynxic
f[x] has joined #ocaml
YuGiOhJCJ has joined #ocaml
Serpent7776 has quit [Ping timeout: 260 seconds]
Tuplanolla has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
f[x] has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]