[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Defstruct default values
- To: preece%ccvaxa@gswd-vms.ARPA (Scott E. Preece)
- Subject: Defstruct default values
- From: Rob MacLachlan <RAM@C.CS.CMU.EDU>
- Date: Sat, 31 May 1986 02:49:00 -0000
- Cc: COMMON-LISP@SU-AI.ARPA
- In-reply-to: Msg of 30 May 1986 11:43-EDT from preece%ccvaxa at gswd-vms.ARPA (Scott E. Preece)
Date: Friday, 30 May 1986 11:43-EDT
From: preece%ccvaxa at gswd-vms.ARPA (Scott E. Preece)
To: COMMON-LISP at su-ai.arpa
Re: Defstruct default values
Maybe I'm missing something, but the book says that the default-init
is evaluated =each time= a structure is to be constructed [emphasis
per CLtL].
This is as opposed to being evaluated once at macroexpand time.
Although the manual doesn't say that the default expression isn't
evaluated if the slot value is supplied to the contructor, it seems
pretty pointless to evaluate the default when it isn't used. Make
that another clarification.
My message was prompted by the discovery that a certain implementation
had taken it upon itself to complain if the default was a constant and
of the wrong type. Due to the dynamic typing in Common Lisp, it is
not erroneous to have an expression which is type incorrect as long as
the expression is never evaluated. It is reasonable for a compiler to
warn about such probable type errors, but the defstruct default seems
to me to be a special case, since syntactic bogosity requires people
to specify spurious defaults.
Rob