Summary
trace: Procedure called with incorrect number of arguments (but still magically works)
Metadata
- Id: 055fcb3060894668a2c7a22bd26bd51b643c1432
- Trac id: 842
- Type: defect
- Reporter: sjamaan
- Owner: felix
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty:
- Resolution: fixed
- Priority: minor
- Milestone:
- Version: 4.7.x
- Changetime: 2012-05-15 09:31:22 UTC
- Created: 2012-05-13 19:41:34 UTC
- Keywords:
Description
The trace egg calls its walk-module procedure with two arguments, but accepts exactly three arguments.
I don't understand why it still works, though:
$ csi #;1> (use trace) #;2> (module foo (bar) (import chicken scheme) (define (bar x) (+ x 1))) #;3> (trace-module 'foo) ; tracing bar
Perhaps the extra argument gets "optimized" away because it is never used? I'd normally say this is a bug in the compiler, but it does warn when you enable scrutiny so it's probably fine to keep the compiler the way it is.
Since the third argument isn't used, I think this patch should be fine, which simply removes the extra argument:
Index: trace.scm
===================================================================
--- trace.scm (revision 26685)
+++ trace.scm (working copy)
@@ -223,7 +223,7 @@
((if (traced? proc) do-untrace do-trace) (list proc)))
procs))
-(define (walk-module mname proc warn)
+(define (walk-module mname proc)
(let* ((m (##sys#find-module mname))
(exps (nth-value 1 (##sys#module-exports m))))
(for-each
By the way, the trace module has no author field in the meta-file. If you don't want to maintain it, maybe you can just put in "the chicken team" or something.
This was found by Mario's specialization run of salmonella: http://parenteses.org/mario/misc/specialize-report/install/trace.html
Changes and comments
[2012-05-13 19:42:21 UTC] sjamaan changed description
[2012-05-15 09:31:22 UTC] felix changed status from new to closed
[2012-05-15 09:31:22 UTC] felix set resolution to fixed
[2012-05-15 09:31:22 UTC] felix wrote:
Thanks for reporting this. I have tagged a new version (0.7). The extra argument is not used so I think you're right in that it will be optimized away.