I recommend reading Groovy’s closure guide. More specifically, the sub-section about delegation strategy. There you’ll see more precisely which object is being used to find the properties and methods.
To answer your questions: yes, you’re right, but AFAIK the examples are different. In the first case, like you said, you’re calling a method called
prop(String s) (either from the closure owner, or from the closure delegate). In the second case, you’re setting a property prop (which means it’s calling a different method
If the property is not found (the delegation strategy defines the search order), then I’m not exactly sure what happens, but I believe it calls a generic method
setProperty(String name, Object value).
Hope this helps