[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
defstruct bug
From: |
Jesper Harder |
Subject: |
defstruct bug |
Date: |
Tue, 03 Feb 2004 17:06:45 +0100 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
In GNU Emacs 21.3.50.38 (i686-pc-linux-gnu, GTK+ Version 2.0.2)
of 2004-02-02 on defun.localdomain
I think the recent improvement in bytecomp.el has uncovered a small
flaw in a an error-form in `defstruct'.
A form like
(defstruct foo
(bar))
macroexpands to:
(progn
(defvar cl-struct-foo-tags)
(defsubst* foo-bar (cl-x)
(or
(and
(vectorp cl-x)
(>=
(length cl-x)
2)
(memq
(aref cl-x 0)
cl-struct-foo-tags))
(error "foo-bar accessing a non-foo" cl-x))
(aref cl-x 1))
...)
The cl-x argument to `error' is unnecessary because there are no
fields to fill in the format string.
*** /usr/local/share/emacs/21.3.50/lisp/emacs-lisp/cl-macs.el~ Mon Sep 1
17:45:20 2003
--- /usr/local/share/emacs/21.3.50/lisp/emacs-lisp/cl-macs.el Tue Feb 3
17:04:01 2004
***************
*** 2261,2268 ****
(list (list 'or pred-check
(list 'error
(format "%s accessing a non-%s"
! accessor name)
! 'cl-x))))
(list (if (eq type 'vector) (list 'aref 'cl-x pos)
(if (= pos 0) '(car cl-x)
(list 'nth pos 'cl-x)))))) forms)
--- 2261,2267 ----
(list (list 'or pred-check
(list 'error
(format "%s accessing a non-%s"
! accessor name)))))
(list (if (eq type 'vector) (list 'aref 'cl-x pos)
(if (= pos 0) '(car cl-x)
(list 'nth pos 'cl-x)))))) forms)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- defstruct bug,
Jesper Harder <=