-
Notifications
You must be signed in to change notification settings - Fork 1
Description
A student wrote in a report on a homework, where I asked for comments about Grace:
I just realized that majority of the hardships that I had with reading grace code at the beginning of this class (it has gotten better) is due to the lack of return statements in the given code ( I know Grace has this statement and I use it). I think return statements are some kind of visual cues that help us skim the code faster and help us spatially understand the code. Or, in the worst case, we have this expectation to see a
returnat the end, and not seeing it there slowed/confused me.
In contrast, @KimBruce Kim Bruce wrote:
I think it is bad style to write
return resultat the end of a method. It should just beresult. I teach my students that return is there only to change the flow of control — e.g., in the middle of a method you determine the answer in an intermediate result and can return immediately.
I have sympathy with both of these points of view, and also with Michael Koening's principle that there should be just a single way of doing things.
It seems that whatever we choose, we can't win.