steenuil has quit [Read error: Connection reset by peer]
amiloradovsky has quit [Remote host closed the connection]
a-kiwi has quit [Ping timeout: 256 seconds]
a-kiwi has joined #ocaml
aaaaaa has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
ski has quit [Ping timeout: 240 seconds]
ski has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 272 seconds]
mfp has quit [Ping timeout: 240 seconds]
aaaaaa has quit [Quit: leaving]
mxns has quit [Ping timeout: 265 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
ski has quit [Ping timeout: 240 seconds]
ski has joined #ocaml
oni-on-ion has joined #ocaml
narimiran has joined #ocaml
mbuf has joined #ocaml
ggole has joined #ocaml
snowpanda has joined #ocaml
infinity0 has quit [Ping timeout: 260 seconds]
Serpent7776 has joined #ocaml
mbuf has quit [Ping timeout: 240 seconds]
banjiewen_ has quit [Ping timeout: 260 seconds]
banjiewen_ has joined #ocaml
metadave has quit [Ping timeout: 260 seconds]
mrallen1 has quit [Ping timeout: 260 seconds]
metadave has joined #ocaml
mrallen1 has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
a-kiwi has quit [Quit: Connection closed]
snowpanda has quit [Quit: Leaving...]
Haudegen has joined #ocaml
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 260 seconds]
steenuil has joined #ocaml
a-kiwi has joined #ocaml
bartholin has joined #ocaml
a-kiwi has quit [Quit: Connection closed]
mfp has joined #ocaml
jbrown has joined #ocaml
mbuf has joined #ocaml
steenuil has quit [Ping timeout: 272 seconds]
rdivyanshu has quit [Quit: Connection closed for inactivity]
def has quit [Ping timeout: 272 seconds]
steenuil has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
def has joined #ocaml
waleee-cl has joined #ocaml
rdivyanshu has joined #ocaml
infinity0 has joined #ocaml
mbuf has quit [Ping timeout: 256 seconds]
a-kiwi has joined #ocaml
Haudegen has joined #ocaml
<d_bot>
<pm> Does anyone have advice for a good team practice to help prevent something like the following:
<d_bot>
<pm>
<d_bot>
<pm> ```ocaml
<d_bot>
<pm> let do_promises u v =
<d_bot>
<pm> (* this let should be a let* *)
<d_bot>
<pm> let _ = promise_1 u in
<d_bot>
<pm> promise_2 v
<d_bot>
<pm> ```
<d_bot>
<pm>
<d_bot>
<pm> In the "real code" case, using `()` instead of `_` would have caught it, but I feel like there's a lesson floating around in here and we got lucky our tests caught this instead of learning the hard way.
<mrvn>
don't use let _
davs has joined #ocaml
<mrvn>
If you always use "let () =" and "let () 0 ignore (something that returns something)" you can avoid it.
<d_bot>
<pm> so then always discharge with ignore if i don't need the result
<d_bot>
<craigfe> Or do `let (_ : typ) = `
davs has quit [Client Quit]
<mrvn>
makes it clear the person has thought about throwing away a return value.
<d_bot>
<craigfe> This is one case where it really would be nice to have an OCaml linter
<mrvn>
craugfe: start one. :)
<d_bot>
<craigfe> I and many others have tried 🙃
<d_bot>
<craigfe> there are very few simple cases
<mrvn>
Maybe this could be a warning in ocaml(c|opt).
<d_bot>
<craigfe> Ignoring a function type is already a warning; I haven't looked back to the discussion when that was introduced, but I imagine that the idea of doing it for all types was rejected then.
<mrvn>
a warning on ignore for normal types would be pointless. unit doesn't need to be ignored so it's always a type.
<mrvn>
I ment a warning on "let _ =" without type annotation.
<d_bot>
<craigfe> Indeed
<d_bot>
<craigfe> It's easy to implement that one as a PPX, at least
<d_bot>
<pm> probably worth opening an issue for to get some input/fast rejection if not desirable as a compiler warning
<d_bot>
<craigfe> other issues that are typically caught by a linter are not; I had a list of them at some point, and decided too many of them would require type information
<mrvn>
pm: it should definetly be an optional one. Using "let _ = ignore (...)" or "let (_ : type) =" over plain "let _ =" is a matter of taste.
<d_bot>
<pm> yeah i'm going to write up a feature wish and my thinking is that it would be optional and not enabled by default
<mrvn>
I could also imagine warning about "let _ = ignore" and "let () = ignore". So it should be more a --ignore-style=<style> warning option.
<mrvn>
But it's really more something that should be in a linter and indentation/coding style checker.
zebrag has joined #ocaml
<d_bot>
<rw> @pm If you use git, it may not be difficult to make a `pre-commit` hook that errors if it finds any occurrence of `let _ =`
inkbottle has quit [Ping timeout: 240 seconds]
<d_bot>
<rw> You would still have to get other team members to copy the hook to their `.git` folder, so it's still not very enforceable unless you make it a part of a CI pipeline.
<mrvn>
or install the hook on the server so they can't push
<d_bot>
<pm> good idea for the short term - we do use ocamlformat as well, maybe they'd be receptive to a rule about this
<d_bot>
<Drup> The best ocaml linter is still the compiler, if you want it, make a new warning about it.
rdivyanshu has quit [Quit: Connection closed for inactivity]
<Armael>
ah well, it's restricted to function types
urek has joined #ocaml
<mrvn>
odd, gasche was against that PR because he uses "let _ = ..." for currently/temporarily unused stuff. Isn't that exactly where you want the warning or simply ignore it till such a time when you use the value?
<mrvn>
Otherwise 10 years from now you still have that unused value in the code for no reason.