[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
portable code walkers vs. portable code
Date: Thu 10 Jul 86 16:43:43-MDT
From: SANDRA <LOOSEMORE@UTAH-20.ARPA>
...
As an example of the kind of code walker I had in mind, consider a simple
cross reference utility, something that traverses a function and keeps
track of what other functions it calls. (Perhaps the purpose of the
utility is to locate references to implementation-specific functions.)
As long as I know exactly where evaluable code can or can't validly appear,
I can certainly write this utility in a portable manner, regardless of
whether the bits of code it analyzes are portable or not. However, if
every implementation is free to extend the syntax of the language however
it wants, it would be impossible to write a portable program that checks
for portable usage!
That is correct. But observe that an implementation is free to add new data
types, and is free to make those data types mean something to the evaluator
(see CLtL, pp. 54-55). For example, I might extend my Common Lisp to
evaluate a vector by evaluating its elements in parallel and returning the
value of just one of them (implemented by choosing the value of whichever
one finishes first). I might introduce a new data type called a mote that
is written as an Internet host number, an underscore, and a digit sequence
(swiping some of the namespace for potential numbers). A mote can serve as
an identifier, much like a symbol, but is shared among all processes on the
network and resides in the specified host. I can let another host know
when I am running ZORK by writing
(defun zork ()
(let ((192.5.100.2_569 t)) ;bind mote 569 in host 192.5.100.2
...
))
Indeed, a (portable (code walker)) cannot hope to deal with such extensions.
The intent of LAMBDA-LIST-KEYWORDS was simply to give a code walker a
fighting chance at deciding whether or not something screwy was going on,
and if so, how screwy it could be.
--Guy