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

eval and other topics



    Date: Wed, 26 Nov 86 17:04 EST
    From: Kent M Pitman <KMP@SCRC-STONY-BROOK.ARPA>

	Date: Wed, 26 Nov 86 15:50 EST
	From: Brad Miller <miller@ACORN.CS.ROCHESTER.EDU>
    
	... While I certainly concur that a lexical eval is not a particularly good
	idea as far as a compiler writer is concerned (because it is very hard, and
	very inefficient), I think it is a TERRIFIC idea for USERS. I've needed the 
	functionality several times, and each workaround is a total hack that has to be
	explained in about a page of extra documentation so the next poor slob that has
	to maintain my code can figure out why I wrote such dreadful code in the first
	place (and what it does). ...

    I (and I'm sure others on this list) would be very interested to see a sketch,
    explanation, or example of a place where you think LEXICAL-EVAL was essential.
    Personally, I can think of no places (other than in debuggging or situations
    closely related to debugging) where it was either essential or even appropriate.
	
    [....]

Well, it's been a while since I gave up on doing things that way, so I don't
have any code handy, but the idea was that given lexical scoping, one can then
define functions with precisely defined scope rules, e.g. using flet. However,
once I had defined these functions, I could not use eval on them, since they
were invisible to the dynamic environment. The details of why I was trying to
do this (seemingly) reasonable thing are hazy, but as I recall in one case,
there were some functions (axioms for a horne clause theorem prover) that were
evaluated normally by some routines that would 'interpret' the language by
calling the routines by prefixing them with a string (to prevent name
conflicts with CL functions). This was the hack - the better solution was to
temporarily redefine these functions using flet so the threaded language could
be interpreted directly, without globally redefining the lisp function. Since
which function had to be called varied somewhat by context (modeled by which
function actually did the interpretation) the same name could serve for each
of these flets - since lexical scoping would not be ambiguous. Instead, with
all functions globably defined, different strings were hacked into the
pseudo-function call names, and then the (new) lisp stream could be eval'd.

There may well be a better hack than this (actually, I'm not the one who ended
up writing it, but I suppose I am responsible for it), however, I don't think
anything might have surpassed the simple and clean elegance of a lexical-eval.

Brad Miller
------
miller@rochester.arpa
miller@ur-acorn.arpa