Hey all. I was just going through some parts of the pathom code and found that there are lots of single-branch if
s, if-let
s etc. Is there some advantage of these in pathom's (or a more general) context over their when...
counterparts?
It makes the code slightly harder to read, because it is unconventional. With an if
I'm always looking for two branches. When I first saw it it really broke my concentration! At least now I know it is intentional. In my own code it would be a 'mistake', that sometimes does happen.
Yeah, we'd also request these to be changed in our own codebase.
no, they are the same, its a preference thing, to me its just that if
has half of the letters of when
, but for a single branch they are equivalent
Makes some sense I guess, thank you for the explanation 🙂