companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
milia has joined #ocaml
rf_ has joined #ocaml
waleee has quit [Ping timeout: 248 seconds]
waleee has joined #ocaml
perrierjouet has quit [Ping timeout: 248 seconds]
rf has quit [Ping timeout: 248 seconds]
rf_ has quit [Ping timeout: 248 seconds]
rf has joined #ocaml
rf_ has joined #ocaml
rf_ has quit [Quit: Leaving]
waleee has quit [Ping timeout: 248 seconds]
waleee has joined #ocaml
rf has left #ocaml [Leaving]
waleee has quit [Ping timeout: 260 seconds]
chrisz has quit [Ping timeout: 265 seconds]
chrisz has joined #ocaml
Haudegen has joined #ocaml
Guest67 has quit [Quit: Client closed]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
Serpent7776 has joined #ocaml
bartholin has joined #ocaml
mro has joined #ocaml
xd1le has joined #ocaml
azimut has joined #ocaml
neiluj has joined #ocaml
olle has joined #ocaml
spip has joined #ocaml
bartholin has quit [Quit: Leaving]
<discocaml> <lukstafi> Hi! Does anyone have an opam-installable replacement for `sed`? For use in CI, it seems testing on MacOS fails due to me calling `sed` to sanitize output before comparison.
<discocaml> <lukstafi> (Or a replacement I could copy-paste into my project.)
<discocaml> <lukstafi> I.e. an OCaml commandline program to run `Str.global_replace`
<adrien> aren't you simply using some gnu-ism?
azimut has quit [Ping timeout: 255 seconds]
<discocaml> <beajeanm> I'm on Mac, and I have sed install (I think by default, I wouldn't have bothered otherwise, it's not really one of the tools I use)
<discocaml> <beajeanm> However, as adrien said, it's not gnu sed (see https://gist.github.com/andre3k1/e3a1a7133fded5de5a9ee99c87c6fa0d)
alexherbo2 has quit [*.net *.split]
mro has quit [Remote host closed the connection]
<discocaml> <lukstafi> @neiluj did you try https://github.com/dariusf/ppx_debug? It's a tracing debugger, i.e. it replays execution traces. It has a vscode extension for visual stepping through code.
<mauke> how are you using sed?
<neiluj> lukstafi: wow, thanks for letting me know about this great project!
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<mauke> I bet its -i option takes an argument
<mauke> if you do something like sed -i.orig ..., it'll work on both sed versions
<mauke> but it'll leave the original version of %{target} around with an .orig file suffix
<discocaml> <lukstafi> Yes, googled this out as well just now. Thanks! `sed -i ''` should not keep the original.
<mauke> that probably won't work with GNU sed
<mauke> alternatively, perl -i -pe '...' works anywhere, but requires perl
kakadu has joined #ocaml
olle has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: Bin weg.]
kakadu has quit [Remote host closed the connection]
<discocaml> <lukstafi> With `sed -i'.bak'` MacOS `sed` doesn't crash, but instead does not do the substitution. 😞
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<Serpent7776> On BSD sed you need a space between -i and argument: `sed -i '.bak'`. It might be the same on MacOS sed.
<theblatte> macos sed doesn't support -i, it does something else there
<theblatte> brew install gnu-sed and use gsed
Anarchos has joined #ocaml
Anarchos has quit [Ping timeout: 250 seconds]
kakadu has joined #ocaml
Anarchos has joined #ocaml
mro has quit [Remote host closed the connection]
kakadu has quit [Quit: Konversation terminated!]
kakadu has joined #ocaml
mro has joined #ocaml
<discocaml> <lukstafi> I removed ` -i ` and added `with-stdout-to` in dune, but this still didn't work: the output file is created but the substitution doesn't happen. Maybe the regex syntax is different?
<discocaml> <lukstafi> (Anyway I don't have a mac or BSD, I'll need to find a box to test things before doing a dune-release.)
Haudegen has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
anpad has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml> <haesbaert> Why not using mktemp and sedding into a temporary file and then moving it ? That way it's still portable
<companion_cube> Moving from a temp file, if it's in /tmp, might not be atomic though
<Serpent7776> What about something like `sed s/foo/xyz/ foo > temp && mv temp foo`?
<adrien> gnu mktemp's tmpdir can be set through $TMPDIR or -p
<adrien> I wouldn't be surprised there is something similar on other implementations
Anarchos has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
hsw has quit [Quit: Leaving]
kakadu has joined #ocaml
olle has joined #ocaml
rf has joined #ocaml
mro has quit [Ping timeout: 265 seconds]
rf has quit [Ping timeout: 248 seconds]
rf has joined #ocaml
chrisz has quit [Ping timeout: 255 seconds]
chrisz has joined #ocaml
xgqt has quit [Read error: Connection reset by peer]
mro has joined #ocaml
xgqt has joined #ocaml
waleee has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
kakadu has quit [Remote host closed the connection]
kakadu has joined #ocaml
kakadu has quit [Client Quit]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
kakadu has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
kakadu has quit [Remote host closed the connection]
kakadu has joined #ocaml
kakadu has quit [Remote host closed the connection]
kakadu has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
mro has joined #ocaml
<discocaml> <lukstafi> If this discussion is still about my problem: I'm doing what I think is the equivalent of `sed s/foo/xyz/ foo > temp` via `with-stdout-to`. But the resulting `temp` does not have the `foo`s replaced.
kakadu has quit [Quit: Konversation terminated!]
<discocaml> <lukstafi> If this discussion is still about my problem: I'm doing what I think is the equivalent of `sed s/foo/xyz/ foo > temp` via `with-stdout-to`. But the resulting `temp` does not have the `foo`s replaced, when on MacOS (it works for me and for the Linux targets).
Haudegen has quit [Quit: Bin weg.]
<discocaml> <RegularSpatula> I had similar issue to you with sed differences in Mac and Linux ….I just write a tiny Perl on liner and used that
kakadu has joined #ocaml
<discocaml> <RegularSpatula> (After giving up on figuring out the differences)
waleee has quit [Quit: WeeChat 3.8]
kakadu has quit [Remote host closed the connection]
<hannes> in my experience, "sed -i -e 's/foo/bar/g' my_file" works nicely across platforms (gnu sed vs bsd sed)
<Serpent7776> I've just checked that on FreeBSD and it created my_file-e backup file.
<hannes> Serpent7776: interesting, on my FreeBSD it does not create a backup file.
<Serpent7776> Hmm, which version are you on? I'm on 12.4-RELEASE.
<hannes> but instead a my_file-e with the old content (which imho is fine)
<hannes> so the "-e" is taken as extension of the "-i". I'm on 13.1
<Serpent7776> Ah, that's what I meant by backup file.
olle has quit [Ping timeout: 264 seconds]
<discocaml> <lukstafi> I plan to write an OCaml executable in the `test/` directory and use that. I remember someone recommended that solution as portable when I first decided to use `sed`, I was just too lazy.
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Ping timeout: 246 seconds]
bartholin has joined #ocaml
motherfsck has quit [Quit: quit]
Haudegen has joined #ocaml
Serpent7776 has quit [Ping timeout: 255 seconds]
alexherbo2 has joined #ocaml
Anarchos has joined #ocaml
waleee has joined #ocaml
Anarchos has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
Tuplanolla has joined #ocaml
mro has quit [Ping timeout: 255 seconds]
rf has quit [Remote host closed the connection]
mro has joined #ocaml
<discocaml> <cemerick> It sure would be handy to be able to deprecate a third-party library's declaration(s) without vendoring or trying to include it in a separate module, deprecate the definition there, and then judiciously only use that variant
neiluj has quit [Quit: WeeChat 3.7.1]
mro has quit [Quit: Leaving]
trillion_exabyte has quit [Ping timeout: 255 seconds]
trillion_exabyte has joined #ocaml
TakinOver has quit [Ping timeout: 250 seconds]
TakinOver has joined #ocaml
bartholin has quit [Quit: Leaving]
TakinOver has quit [Ping timeout: 260 seconds]
Stumpfenstiel has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
TakinOver has joined #ocaml
<dh`> how is one supposed to profile these days? compiling with -p says it's no longer supported
TakinOver has quit [Ping timeout: 260 seconds]
TakinOver has joined #ocaml
<dh`> apparently you can compile with ocamloptp instead of ocamlopt, but that generates a syntax error in some internal temporary file
<dh`> more precisely, it can't build ocamllex output
<dh`> also you have to disable -warn-error because it generates open shadowing warnings
waleee has quit [Ping timeout: 260 seconds]
<octachron> perf or a similar OS system tool? Or landmarks if you want to instrument some functions.
<octachron> A ppx like landmark is far more reliable than `ocamloptp` or friend ever was.
waleee has joined #ocaml
<dh`> ocamlprof doesn't seem to exactly be release quality anyway
<dh`> ocamlprof compute.ml compile ml -> Fatal error: exception Invalid_argument("index out of bounds")
<dh`> landmark doesn't seem to be what I want
<dh`> gprof is, as in for all it sucks it does do what it's supposed to
<dh`> how a system tool is supposed to give useful information without knowing anything about basic blocks idk
waleee has quit [Ping timeout: 250 seconds]
waleee has joined #ocaml
Stumpfenstiel has quit [Ping timeout: 248 seconds]
<companion_cube> dh`: perf?
Tuplanolla has quit [Ping timeout: 240 seconds]
<discocaml> <masterbuilder> perf is awesome, definitely third that
Haudegen has quit [Ping timeout: 255 seconds]
perrierjouet has joined #ocaml
mauke_ has joined #ocaml
mauke has quit [Ping timeout: 252 seconds]
mauke_ is now known as mauke