A coworker struggled finding the reason why their Debug.log didn't fire anything. The log function was actually assigned to _, a common pattern we use in the company, but missing the last parametter. It was actually assigning the identity function to underscore.
Shouldn't it fire some kind of error or warning, as it's probably not intended ? Assigning a function to _ (underscore) could be a compile error, or maybe using Debug.* missing a parameter be forbidden to ensure no silent behaviour ?
It could go in elm-review, but we do not run this on each file save, so I don't know to how much extend this could be as good as a solution.
SSCCE
hello =
let
_ : a -> a
_ =
Debug.log "Hello"
in
"world"
Quick Summary: ???
A coworker struggled finding the reason why their
Debug.log
didn't fire anything. The log function was actually assigned to_
, a common pattern we use in the company, but missing the last parametter. It was actually assigning the identity function to underscore.Shouldn't it fire some kind of error or warning, as it's probably not intended ? Assigning a function to _ (underscore) could be a compile error, or maybe using Debug.* missing a parameter be forbidden to ensure no silent behaviour ?
It could go in elm-review, but we do not run this on each file save, so I don't know to how much extend this could be as good as a solution.
SSCCE