[Openmcl-devel] Reader Macro Question

Brent Fulgham bfulg at pacbell.net
Wed Jan 31 06:24:24 UTC 2007


I just realized I don't understand the way reader macros work, at  
least with respect to the "#+ccl" and "#-ccl" values:

I always thought a form like:

(let ((a #+openmcl
              "Whee"
             #-openmcl
             "Whoops"))
        (format t "~a~%" a))

... would conditionally provide the right text based on the certain  
pre-defined settings in the current environment.  So, in OpenMCL I  
get "Whee", and in MCL 5.1 (Demo) I get "Whoops".

So far, so good.  But I'm confused how the corresponding "#+/-ccl"  
stuff works:

? (in-package :ccl)
#<Package "CCL">

(let ((a #+ccl
              "Whee"
             #-ccl
             "Whoops"))
        (format t "~a~%" a))

... Gives me "Whoops".

Also, the following:

(eval-when (:compile-toplevel :load-toplevel :execute)

   (defmacro MEMORY-ALLOC (Size)
     #+ccl `(#_NewPtr ,Size)
     #-ccl (error "MEMORY-ALLOC not implemented")))

Indicates the error case:

? (eval-when (:compile-toplevel :load-toplevel :execute)

   (defmacro MEMORY-ALLOC (Size)
     #+ccl `(#_NewPtr ,Size)
     #-ccl (error "MEMORY-ALLOC not implemented")))

;Compiler warnings :
;   Unused lexical variable SIZE, in MEMORY-ALLOC.
MEMORY-ALLOC
? (MEMORY-ALLOC 3)
 > Error: MEMORY-ALLOC not implemented
 > While executing: MEMORY-ALLOC, in process Listener(4).
 > Type :POP to abort, :R for a list of available restarts.
 > Type :? for other options.

Are #+ccl and #-ccl special beasts that can't be used the way the # 
+openmcl or similar guards work?

Thanks,

-Brent





More information about the Openmcl-devel mailing list