On Tue, Jun 10, 2008 at 11:53 PM, Willem Broekema metawilm@gmail.com wrote:
On Tue, Jun 10, 2008 at 11:04 PM, Bradford W Miller
(defun f (x y) (let ((y x) (x y)) ...))
I should make clear that the frame variable duplication happens without the programmer introducing a new variable. The reason for this patch is that it is a bit annoying to see an extra line that has no extra information:
(defun f (x y) (declare (optimize debug)) (zut (bar x) y))
Compiling and calling (f 1 2) results of course in:
Error: attempt to call `bar' which is an undefined function.
and zooming to the corresponding frame for of the f call gives:
[1] cl-user(37): :loc Compiled lexical environment: 0(required): x: 1 1(required): y: 2 2(local): y: 2
which slime displays the frame as:
4: (f 1 2) Locals: x = 1 y = 2 y = 2
while it would make more sense to see:
4: (f 1 2) Locals: x = 1 y = 2
But there is the opposite case: a user introducing a variable binding that has identical name and value as a parameter (or an outer binding). This patch could remove a duplicated line that the user expected to see twice.
However, it seems very unlikely to me that that poses any problem: the compiler could optimize away a local variable; there is no guaranteed order in which the variables are listed. Meanwhile the unintended duplicates are a more frequent annoyance.
(Perhaps a better way to handle this, would be to include the "required" / "local" labels in the listing of the local variables?)
- Willem