help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: lisp style question


From: Thomas A. Russ
Subject: Re: lisp style question
Date: 06 Dec 2010 14:24:58 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

RG <rNOSPAMon@flownet.com> writes:

> There's another solution that doesn't seem to have been mentioned yet:
> 
> ? (defstruct thing width height weight)
> THING
> ? (setf thing (make-thing :width 1 :height 2 :weight 3))
> #S(THING :WIDTH 1 :HEIGHT 2 :WEIGHT 3)
> ? (thing-height thing)
> 2
> ? (slot-value thing 'height)
> 2

SLOT-VALUE is not guaranteed to work on structures.  Whether it does or
not is implementation dependent.  It hinges on the particular way
structures are implemented in each implementation, since they are not
required to belong to STANDARD-CLASS.

>From the Hyperspec:

   The specific behavior depends on object's metaclass. An error is
   never signaled if object has metaclass standard-class. An error is
   always signaled if object has metaclass built-in-class. The
   consequences are unspecified if object has any other metaclass--an
   error might or might not be signaled in this situation. Note in
   particular that the behavior for conditions and structures is not
   specified.

which explicitly notes that the behavior for structures is not
specified.

-- 
Thomas A. Russ,  USC/Information Sciences Institute


reply via email to

[Prev in Thread] Current Thread [Next in Thread]