Lisp HUG Maillist Archive

dspec question

I thing I am missing something important with dspecs. I would like to record
definitions of top-level forms I've defined but with no success. The
following example from the documentation of dspec:location does not work for
me:

(defmacro define-wibble (x y)
   `(dspec:def (define-wibble ,x)      
    (set-wibble-definition ',x ',y (dspec:location))))

(defun set-wibble-definition (x y loc)
   (when (record-definition `(define-wibble ,x) loc)
    ;; defining code here
    )) 

If I evaluate these two forms and then try for example

(define-wibble a 10)

I get "Illegal dspec (DEFINE-WIBBLE A)." error.

Any suggestions? I'd appreciate any working example.

Michal


RE: dspec question

Michal Krupka wrote:
> I thing I am missing something important with dspecs. I would 
> like to record definitions of top-level forms I've defined
> but with no success. The following example from the
> documentation of dspec:location does not work for me:
> 
> (defmacro define-wibble (x y)
>    `(dspec:def (define-wibble ,x)      
>     (set-wibble-definition ',x ',y (dspec:location))))
> 
> (defun set-wibble-definition (x y loc)
>    (when (record-definition `(define-wibble ,x) loc)
>     ;; defining code here
>     )) 
> 
> If I evaluate these two forms and then try for example
> 
> (define-wibble a 10)
> 
> I get "Illegal dspec (DEFINE-WIBBLE A)." error.
> 
> Any suggestions? I'd appreciate any working example.


I think the example is incomplete. Try adding this:

(dspec:define-dspec-alias define-wibble (name)
  `(defun ,name))

You could also take a look at my web page at
http://www.nomistech.com/misc/dspec-lw-4-3-correct-usage.lisp
for more examples. It's a bit bare-bones but I think it will help.

Simon



RE: dspec question

Hello Simon,

thank you for your suggestion. I'll take a look to your example file, I'm
sure I'll find everything I need there.

Michal


Updated at: 2020-12-10 08:50 UTC