chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #ocaml
Serpent7776 has joined #ocaml
bartholin has joined #ocaml
Haudegen has joined #ocaml
bartholin has quit [Quit: Leaving]
olle has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 244 seconds]
euphores has quit [Ping timeout: 276 seconds]
euphores has joined #ocaml
semarie_ has joined #ocaml
semarie has quit [Killed (tantalum.libera.chat (Nickname regained by services))]
semarie_ is now known as semarie
hannes_ has quit [Quit: leaving]
Haudegen has quit [Quit: Bin weg.]
mange has quit [Quit: Zzz...]
Haudegen has joined #ocaml
olle has quit [Ping timeout: 252 seconds]
olle has joined #ocaml
olle has quit [Ping timeout: 252 seconds]
infinity0 has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 252 seconds]
mccd has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 276 seconds]
wickedshell has joined #ocaml
mccd has quit [Quit: Client closed]
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
bibi_ has joined #ocaml
Guest8631 has quit [Read error: Connection reset by peer]
myrkraverk has quit [Read error: Connection reset by peer]
myrkraverk has joined #ocaml
bartholin has joined #ocaml
<discocaml>
<functionalprogramming> does the ocaml standard library include a `string -> string -> bool` function to check if a string exists as a substring within another?
<companion_cube>
I don't think the stdlib does
<discocaml>
<functionalprogramming> what a terrible day
Tuplanolla has joined #ocaml
<companion_cube>
I have one in containers but yeah, it's a big hole
<discocaml>
<yawaramin> technically not the 'standard library', but `Str.string_match` does the job
<companion_cube>
please no 😰
<discocaml>
<yawaramin> (though tbh i don't agree that `unix`/`str` are not in the 'standard library', they are just not linked by default)
<companion_cube>
unix is fine, str would be at the bottom of mountain Doom if not for retrocompat
<discocaml>
<yawaramin> so everybody says but is there any word of replacing it with eg `Stdlib.Re`?
<companion_cube>
in my book neither are in the stdlib
<companion_cube>
so yeah, just use re
<discocaml>
<deepspacejohn> I don't recall ever seeing someone propose this, but TBH I think it would be much more appreciated (and probably much simpler) than most other often-requested stdlib features.
<companion_cube>
it's not simpler no
<companion_cube>
you need a not totally trivial algorithm
<companion_cube>
that said it's worth it++
<discocaml>
<undu> is Re still not thread-safe?
<dh`>
in what world would a regexp library need or want to be thread-safe?
<companion_cube>
if you have a toplevel `Re.re lazy` or something, I suppose
<companion_cube>
generally if you try to cache the compiled regex, the cache might need to be thread safe
<discocaml>
<deepspacejohn> In my mind I was comparing it to APIs like `repr` that have had multiple people request to add it (or something similar) but which has no obvious design that fits the stdlib. regular expressions aren't simple but their design is solvable.
<dh`>
true but I wouldn't expect the library to do that for me
<companion_cube>
adding Re would be actually nice
<companion_cube>
but then it'd also need to be unicode aware 😬
<dh`>
however, using a regexp library to do simple substring matching seems like sixteen kinds of overkill
<discocaml>
<undu> > in what world would a regexp library need or want to be thread-safe?
<discocaml>
<undu> in a world where webservers spin up a thread per request 😐
<discocaml>
<contificate> said it before, but: it's effectively very bad to allow user input in regexes, rendering the vast majority of them as constant - so really, languages need to adopt a re2c like precompilation of regexes, but generalised to anything with regular structure (as re2c is)
<discocaml>
<contificate> then there'd be no weird NFA engines with bizarre state
<discocaml>
<contificate> just a lexer generator as a core part of the language
<discocaml>
<contificate> which doesn't seem that wild, given we have pattern matching and Caml Light literally had stream matchers for writing parsers
<dh`>
undu: again, why would the regexp library need or want to be thread-safe?
<discocaml>
<deepspacejohn> I mean, the compiler already reuses the string syntax to construct format specifiers, which is pretty similar
<discocaml>
<contificate> dh: I guess you need to consider the overheard of the regex construction. I don't think many regex libraries ever fully determinise a DFA from the given input but, despite this, the cost of NFA construction (or whatever it be) leads to people precomputing the representation of regular expressions
<discocaml>
<contificate> if you then use the same regex, across threads, you'd want that to be fine
<discocaml>
<contificate> I can't recall the exact problem with Re, if it's of this shape or not
<discocaml>
<contificate> guess the question is really whether `Re.exec` is threadsafe, when multiple threads are using the same `Re.re` (compiled regular expression)
<companion_cube>
but that's Re.Str
<companion_cube>
because it exposes Str's terrible API
<discocaml>
<yawaramin> so does that mean that other submodules are thread-safe?
<discocaml>
<contificate> didn't see this, but yeah: they also use a preprocessor over `emit.mlp` files to much the same effect in the backend, as part of formatting strings during instruction selection
<discocaml>
<contificate> `s/during/for`
<companion_cube>
now I just feel like recommending re2 yeah
<companion_cube>
or pcre or something that works
<companion_cube>
(not Str)
<dh`>
ok, that seems broken
<dh`>
it's reasonable to expect matching to be stateful and need to be thread-safe, not reasonable for a compiled regexp to be stateful
hidjgr has quit [Remote host closed the connection]
hidjgr has joined #ocaml
<dh`>
(but also, not reasonable to actually want to share matching state across threads, hence the original claim)
<discocaml>
<contificate> nobody wants to do that though, the fact it's not thread safe is the only reason that sharing is happening - and not in a safe way
<discocaml>
<cod1r> contificate, do you do tutoring or no
<discocaml>
<contificate> tutoring for what
<discocaml>
<cod1r> the knowledge that you have
<discocaml>
<contificate> on OCaml-related topics, you will get a better variety of viewpoints by just asking on here
<discocaml>
<contificate> as I am not an expert at OCaml
<discocaml>
<cod1r> 🙇♂️
<discocaml>
<contificate> just get into compilers, they sit at the crossroads of a lot of very interesting parts of computer science
<discocaml>
<contificate> as you fill that out, through its numerous rabbit holes, you learn a lot of very useful things
<discocaml>
<cod1r> im gonna add u as a fren to gain some free clout
<discocaml>
<cod1r> wow
<discocaml>
<cod1r> not even fren requests
<discocaml>
<cod1r> gigachad
<dh`>
yeah, insult people who are helping you
<discocaml>
<contificate> I've sent you a req, cod1r (saying here so it doesn't look like I left you hanging)
<discocaml>
<cod1r> dh: i was not insulting mister contificate here
<discocaml>
<cod1r> at least it was not intentional
hidjgr has quit [Changing host]
hidjgr has joined #ocaml
<dh`>
"gigachad" certainly sounds like an insult
myrkraverk_ has joined #ocaml
bartholin has quit [Quit: Leaving]
<discocaml>
<._null._> When you know what it means, you know it isn't meant as an insult