[armedbear-devel] SLOT-VALUE and SLOT-VALUE-USING-CLASS with DEFSTRUCT

Alessio Stalla alessiostalla at gmail.com
Mon Jun 14 21:22:42 UTC 2010


On Mon, Jun 14, 2010 at 4:09 AM, William Wadsworth
<will.wadsworth.10 at gmail.com> wrote:
> Hi.
>
> The following transcript demonstrates the problem.
>
> --- BEGIN
> Armed Bear Common Lisp 0.20.0
> Java 1.6.0_20 Sun Microsystems Inc.
> Java HotSpot(TM) Client VM
> Low-level initialization completed in 0.667 seconds.
> Startup completed in 4.849 seconds.
> Type ":help" for a list of available commands.
> CL-USER(1): (defstruct x a b c)
> X
> CL-USER(2): (slot-value (make-x :a 10) 'a)
> #<THREAD "interpreter" {118958E}>: Debugger invoked on condition of
> type UNDEFINED-FUNCTION
>  The function SLOT-VALUE is undefined.
> Restarts:
>  0: CONTINUE     Try again.
>  1: USE-VALUE    Specify a function to call instead.
>  2: RETURN-VALUE Return one or more values from the call to SLOT-VALUE.
>  3: TOP-LEVEL    Return to top level.
> [1] CL-USER(3): :res
> CL-USER(4): (slot-value (make-x :a 10) 'a)
> #<THREAD "interpreter" {118958E}>: Debugger invoked on condition of
> type SIMPLE-ERROR
>  There is no applicable method for the generic function
> #<STANDARD-GENERIC-FUNCTION MOP::SLOT-VALUE-USING-CLASS {932FE}
>> when called with arguments (#<STRUCTURE-CLASS X {11EF443}> #<X {1184326}> A).
> Restarts:
>  0: TOP-LEVEL Return to top level.
> [1] CL-USER(5): :res
> CL-USER(6):
> --- END
>
> DEFCLASS seems to work fine, though I would like to keep using DEFSTRUCT.
> I understand that the MOP is not really complete. However, Is there a workaround
> that will not resort in using DEFCLASS?

At glance, what you ask is not there but can be implemented without
too much effort. Structures already carry (on the Java side)
information about their slots, which is used by the inspector. So,
stay tuned ;)

Cheers,
Alessio




More information about the armedbear-devel mailing list