I finally got my photo album app to build with 0.19! 
Then, I tried to build it with --optimize and, as promised in the upgrade docs, it’s complaining that I’m using functions from Debug. :-/
I completely understand why we can’t make an optimized program that uses Debug.toString or Debug.todo. However, the reasoning for Debug.log is not so clear.
Maintaining Debugging Hooks in Code
I guess first off, I’m struggling with how to handle the maintenance issue: Those Debug.log function calls are (1) landmarks in the code that tell other devs “this bit is tricky” and (2) useful to have on hand when I drop out of --optimize and work on the next feature or tweak or whatever and discover that something that used to work has suddenly quit working. (I know comments are another way of doing #1, but Debug.log is like an “active” comment – it doesn’t just tell you it’s tricky “statically”, it helps you follow along as the program executes dynamically.)
My best idea right now is to keep a remove Debug.log calls commit in my git history that I can git revert when I need to. That’s much more automatic than manually commenting / uncommenting things, but of course it’s vulnerable to bitrot (conflicts).
Ways to Support Debug.log in --optimize
It’d be better of course if I could just leave those Debug.log calls in there all the time!
It seems that using an implementation like:
log : String -> a -> a
log _ value =
value
… in --optimize mode would be just fine, no? If there are optimizations that wouldn’t work in the presence of such an implementation, I don’t know what they would be.
Of course there would be some cases where the string arg you’re passing in to log is produced with Debug.toString, so you’d have to comment those out before using --optimize. However, at least in my codebase, the vast majority (28 of 30) of Debug.log invocations are not reliant on Debug.toString to produce the string that they’re logging.
An even nicer --optimize variant would be:
log : String -> a -> a
log str value =
{- some native magick to do 'console.log(str);' -}
value
… in other words, dropping the implicit ++ Debug.toString value that gets tacked on the end would still be useful in a lot of cases.
I think in the past I’ve been unable to use that because my model contains functions.