Dear all:

I've been developing a library that needs some macro coding. As I come from Common-Lisp and Elisp, I find more pleasing the old-style define-macro. The following function is used as a part of the result building of another define-macro:

  (define (new-field-mono f-name (default-value null))
    (let ((field-name (append-id "-" f-name))
          (set-name (append-id f-name "-set!")))
      `(begin
         (field [,field-name ,default-value])
         (define/public (,f-name) ,field-name)
         (define/public (,set-name value)
           (set! ,field-name value)))))

The problem is in the line of the "field". As default-value is null "()", the field declaration gets:

(field -xxx ())

Then, the expansions sees this "()", and thinks it is an application of no-function, getting the error:

#%app: missing procedure expression;
 probably originally (), which is an illegal empty application in: (#%app)

So how could I specify some default value in that function so that the field gets its default value as null? Using '() as default-value doesn't work either, but however, if I generate exactly:

(field [,field-name null])

it works, so I'm expecting that more macro conversion steps are executed to the unquote operator, but my knowledge doesn't go that far.

        Thanks,
        diego.


--
Diego Sevilla Ruiz -- http://ditec.um.es/~dsevilla/ -- dsevi...@um.es _.___
Dep. Ingeniería y Tecnología de Computadores, Facultad de Informática D|TEC
Univ.de Murcia,Campus Espinardo,30080 Murcia (SPAIN),Tel.+34868887571
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to