This question is a bit convoluted, so please bear with me…
I have some common functions that I use occasionally for tracing and such. For example, Common.ii/2
provides a shorthand version of IO.inspect/2
:
foo = bar
|> ii(:bar)
...
If I want to keep a trace around for later, I comment it out. To keep my code tidy, I use an import
statement:
import Common, only: [ ii: 2 ]
However, if none of the traces are currently in use, this generates a warning:
warning: unused import Common
So, I have to comment out the import
line:
# import Common, only: [ ii: 2 ]
My problem arises when I import more than one function, only one of which may need to be commented out:
import Common, only: [ ii: 2, str_list: 1 ]
I tried using multiple import
statements, but this fails silently (only the last one takes effect):
import Common, only: [ ii: 2 ]
import Common, only: [ str_list: 1 ]
So, I’m forced to use some rather awkward code formatting:
import Common, only: [ # ii: 2,
str_list: 1 ]
Comments? Clues? Suggestions?