Re: SICP Chapter 2, Footnote 3




> Regarding your original question, note that a procedure can well be
> called without using its name directly.
>
> (define (foo callback)
> .... (callback) ...)
>
> (define (my-func) ...)
> (trace my-func)
> (foo my-func)
>
> If we want to see all the places where my-func is called, the tracing
> must also be activated from inside foo. This is much easier to
> accomplish if the my-func _procedure_ is specially tagged instead of
> the variable that is bound to it.

That's a good point. I tested that explicitly in UCB Scheme after
reading your post and would guess that it's doing something more
sophisticated and harder to implement since it behaves as I expect and
want it to..

(define combine cons)
(define (dummy-test fn val1 val2)
(fn val1 (fn val2 '())))

STk>(trace combine)
okay
STk>(dummy-test cons 1 2)
(1 2)
STk>(dummy-test combine 1 2)
[4 lines of trace output]
(1 2)

The SICP footnote may not have been accounting for these types of
implementations. I'm glad, however, that UCB Scheme works in this
fashion; it makes my life easier. :-)

.



Relevant Pages

  • Re: SICP Chapter 2, Footnote 3
    ... >> (trace my-func) ... > STk>(dummy-test cons 1 2) ... > [4 lines of trace output] ... would produce no tracing output at all, ...
    (comp.lang.scheme)
  • Re: question about nonaligned memory access
    ... three bits, the tag of the object, are 001, the tag for a cons cell. ... When the function foo is being compiled in safe code, ... which was the address of the instruction that did the ... handled by a signal handler. ...
    (comp.arch)
  • Re: Limited initialization for non-limited types
    ... Trace_Stash: Trace; ... package body Foo is ... function Construct_Xreturn Nil; ... Why do I have a constructor function for X that returns Nil? ...
    (comp.lang.ada)
  • Re: move confusion with PUSH
    ... Return to top loop level 0. ... Also note the difference between CONS and PUSH. ... and then look at foo, ... Do you have a tutorial for Common Lisp, ...
    (comp.lang.lisp)
  • Re: append and read-traces
    ... % set x abc; proc handler args ... % # read trace fired: ... set v "$w FOO!" ...
    (comp.lang.tcl)