companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
Tuplanolla has quit [Ping timeout: 256 seconds]
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> and this particular antipattern has bothered me for a while: https://www.craigfe.io/posts/pitfalls-of-polymorphic-ignore
<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
<d_bot> <craigfe> In fact, it seems that the Jane Street PPX linter does exactly this: https://github.com/janestreet/ppx_js_style#-allow-unannotated-ignores
<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]
ski has quit [Ping timeout: 240 seconds]
ski has joined #ocaml
<Armael> seems relevant?
<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.
urek has quit [Ping timeout: 272 seconds]
urek__ has joined #ocaml
narimiran has quit [Quit: leaving]
Tuplanolla has joined #ocaml
bartholin has quit [Quit: Leaving]
Jeanne-Kamikaze has joined #ocaml
TheLemonMan has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
urek has joined #ocaml
urek__ has quit [Ping timeout: 272 seconds]
Anarchos has joined #ocaml
hnOsmium0001 has joined #ocaml
a-kiwi has quit [Quit: Connection closed]
berberman has quit [Quit: ZNC 1.7.5 - https://znc.in]
berberman has joined #ocaml
osa1 has quit [Quit: osa1]
osa1 has joined #ocaml
berberman has quit [Quit: ZNC 1.7.5 - https://znc.in]
berberman has joined #ocaml
Haudegen has joined #ocaml
ski has quit [Ping timeout: 256 seconds]
berberman_ has joined #ocaml
berberman has quit [Ping timeout: 264 seconds]
jbrown has quit [Ping timeout: 272 seconds]
jbrown has joined #ocaml
urek has quit [Ping timeout: 272 seconds]
urek has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
amiloradovsky has joined #ocaml
a-kiwi has joined #ocaml
aaaaaa has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
osa1 has quit [Quit: osa1]
osa1 has joined #ocaml
ggole has quit [Quit: Leaving]
a-kiwi has quit [Ping timeout: 246 seconds]
a-kiwi has joined #ocaml
catern has quit [Ping timeout: 256 seconds]
engil has quit [Ping timeout: 256 seconds]
engil has joined #ocaml
engil has quit [Changing host]
engil has joined #ocaml
neiluj has joined #ocaml
neiluj has quit [Changing host]
neiluj has joined #ocaml
drewolson9 has joined #ocaml
drewolson has quit [Ping timeout: 256 seconds]
drewolson9 is now known as drewolson
rntz2_ has quit [Ping timeout: 256 seconds]
rntz2 has joined #ocaml
catern has joined #ocaml
neiluj has quit [Quit: leaving]
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
terrorjack has quit [Read error: Connection reset by peer]
terrorjack has joined #ocaml
mxns has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]