Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
It would be helpful if the parameters that are passed to the closures for the different each* methods would be better documented, maybe in a semi.formal way. In the case of Reader.eachLine and File.eachLine it looks like not only the line itself is passed to the closure but also the line number(oddly the line number seems to be one-based and not zero-based like everything else in Groovy/Java/Computer Science).
To get this information right now someone needs to look at:
http://svn.groovy.codehaus.org/browse/~raw,r=12115/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
Similarly the documentation for File.eachFileResurse and others could be improved by stating if both (real) files and directories or only one of those two are passed to the closure.
Maybe a general convention for documenting closure parameters could be setup.