GrailsInAction / graina2

Source code for the 2nd edition of Grails in Action
90 stars 92 forks source link

v14 7.2.4 Reference to "with operator" needs clarification #88

Open nlwillia opened 10 years ago

nlwillia commented 10 years ago

After listing 7.11, the book states "In this sample, we've made use of the Groovy with operator that we introduced in Chapter 2 as a shorthand way of setting up our form parameters for the user object."

So far as I can find, there's no mention of this feature in chapter 2, and considering that it's nearly impossible to Google for, a better explanation or more precise definition (it's a method of Object, not an operator) would be helpful.

http://groovy.codehaus.org/groovy-jdk/java/lang/Object.html#with%28groovy.lang.Closure%29 http://javajeff.blogspot.com/2008/11/getting-groovy-with-with.html

pledbrook commented 10 years ago

Good point. Chapter 2 went through several major rewrites and chapter 7's first draft happened before the final one :smile: Not sure whether to add this into chapter 2 or just give a quick summary of its effect in chapter 7 with a link to the Groovy JDK page for it. I'll need to re-read chapter 2 to see whether there is an appropriate place for this.

Thanks for the report!

pledbrook commented 10 years ago

I think rewording it to "with() method" and adding link to the docs would be the best approach here.