Mark Elston (111) [Avatar] Offline
As I was reading this section I completely missed an important part of the refactoring and it caused my compilation to fail and i couldn't quite figure it out for a while. Specifically you changed from:

fun eval(e: Expr): Int {


fun eval(e: Expr): Int =

As I was following along I left the braces in and didn't use the '=' and got compilation errors regarding the need for an explicit return from the block. After I finally noticed what you were doing I made the change and all was well.

I would think that a change like this, especially early in the book, would be valuable to point out as well as the reason for it. I went back and realized you (very briefly) discussed this when you mentioned 'expression bodies' but I think the significance of what you said went by me. A passing reference to the change to an expression body would be useful in the discussion here.
Dmitry Jemerov (39) [Avatar] Offline
Thanks for your feedback! I've changed the text to explain the change we're making more explicitly.