[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

applyhook



    Date: Thu 6 Sep 84 11:28:26-EDT
    From: Walter van Roggen <WVANROGGEN at DEC-MARLBORO.ARPA>

    And my point was there's no way to get the "environment" part of a
    closure explicitly. Sure, implementors don't have to use it because
    they have access to the internals; but CL users won'be able to
    evaluate forms in the environment current at the application otherwise.
    Unless there's some contorted hack you can pull using EVALHOOK....

Given:
 ((LAMBDA (Y) ((LAMBDA (X) (+ X Y)) 4)) 3)
You can get traps at:

	Data				Env		Hook

1 ((LAMBDA (Y) ...) 4)			()		EVALHOOK
2 (LAMBDA (Y) ...), (4)			none		APPLYHOOK
3 ((LAMBDA (X) ...) 3)			((Y 4))		EVALHOOK
4 (LAMBDA (X) ...), (3)			none		APPLYHOOK
5 (+ X Y)				((X 3) (Y 4))	EVALHOOK

The situation you're worried about is not having the environment at point
2 and 4. But since no destructive computation ever happens between situations
like 2 and 3 or 4 and 5, it doesn't matter. Whatever code you intended to
run at 2 and 4 can just as well run at 3 and 5 where the info is available.

Really, though, APPLYHOOK and EVALHOOK are not as closely related as
you are trying to make them seen. They're both useful in debugging, but
for much different things.

EVALHOOK is generally used to monitor the local state within a lexical
contour, making sure that evaluation is proceeding correctly in that
context.

APPLYHOOK is used to monitor transitions between one lexical contour
and another. When travelling through that path, the only information
you carry with you is the parameters you pass (and special variables,
which are available at all times anyway). It would be inappropriate for
APPLYHOOK to get an ENV arg because it's between two contours; I am not
even clear on whether you are asking for it to receive the contour 
of the state you're coming from or that of the state you're going to.
In any case, I think it simply shouldn't get any at all.

Do you agree with this? Can you suggest a non-contrived application 
which contradicts this line of reasoning?
-kmp