[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #842: trace: Procedure called with incorrect numb
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #842: trace: Procedure called with incorrect number of arguments (but still magically works) |
Date: |
Sun, 13 May 2012 17:42:22 -0000 |
#842: trace: Procedure called with incorrect number of arguments (but still
magically works)
-------------------------+--------------------------------------------------
Reporter: sjamaan | Owner: felix
Type: defect | Status: new
Priority: minor | Milestone:
Component: extensions | Version: 4.7.x
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Description changed by sjamaan:
Old 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.
>
> {{{
> 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
New 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
--
--
Ticket URL: <http://bugs.call-cc.org/ticket/842#comment:1>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.