unused opt-callback in trunk/src/report/utility-reports/view-column.scm
Larry Evans
cppljevans at cox-internet.com
Tue Jul 18 10:59:26 EDT 2006
On 07/18/2006 08:51 AM, Derek Atkins wrote:
[snip]
> I'm sorry it confused you. But I think it's okay (and a GOOD IDEA)
> to parse out a list into its components even if you don't use every
> component of the list. It lets future developers understand it, and
> one day a future developer may want to use that callback. If it were
> removed they'd have to go back to the beginning and figure out how
> the callback is passed in.
Good point, but a better (IMHO) method is to document the "type"
of report-info with comments somewhere in the file. Something like:
;;Types:
; (<report-id>
; (gnc:make-report
; report-name ; name of report ('name arg to gnc:define-report).
; )
; )
; (<report-info>
; (list
; report-id ; <report-id>
; row-span ; rows occupied by subreport, report-id.
; col-span ; columns occupied by subreport, report-id.
; callback ; either #f or callback to set options for report-id.
; )
; )
This would have helped me in figuring out the type of the last
argument to:
(gnc:make-internal-option
"__general"
"report-list"
'()
)
. As it was, I had to put some print statements in, examine a bunch of
other code, try looking at dialog-column-view.c. I can't remember what
finally prompting my understanding of what the type was (maybe I
stumbled across cleanup-options where an instance of <report-info>
is created), but some type of documentation as suggested above along
with:
(gnc:make-internal-option
"__general"
"report-list"
'() ;list of <report-info>
)
would have made things much easier. In the case of view-column.scm
around line 121, this could be used as:
(lambda
(report-info ;<report-info>
)
(let* ((subreport (gnc:find-report (car report-info)))
(colspan (cadr report-info))
(rowspan (caddr report-info))
...
thus documenting the type of report-info argument there, as well as
elsewhere in the report and eliminate the opt-callback unused
variable. Thus, any future modifier of the report would know
how to access the opt-callback in the above lambda as well as
how to create a list of <report-info> in the make-internal-option
earlier in the code.
More information about the gnucash-devel
mailing list