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

Portable declarations



In regards to Scott's COMPILER-VARIABLE item...

    (DECLARE (COMPILER-VARIABLE implementation (var1 val1) (var2 val2) ...))

... could people comment on the idea that anything that wanted to hack
compiler declarations would have to first macroexpand the first item 
and then check it for DECLARE-ness? This'd let you write user-code like:

    (DEFMACRO OPSYS-CASE (&BODY STUFF) ;doesn't error check much
      `(PROGN ,@(CDR (OR (ASSQ (STATUS OPSYS) STUFF)
			 (ASSQ 'T STUFF)))))
and later do
    
   (LET* ((X 3) (Y X))
     (OPSYS-CASE
       (VAX   (DECLARE (TYPE-CHECK-CAR/CDR NIL) (SPECIAL X)))
       (S3600 (DECLARE (SPECIAL X))) ;type checking in microcode
       (T     (DECLARE (SPECIAL X))) ;who knows? 
     ...stuff...)

and the system would not have to have special knowledge about the macro you've
written doing a DECLARE thing. It'd just macroexpand form1 in LET* and find
the DECLARE there and move it as appropriate.

This gives greater flexibility with respect to declarations, too, since it
allows one to write declaration-writing macros.

I haven't thought all the consequences fully, but at first pass I can see no
problems about it other than just remembering to call MACROEXPAND in the few
places where you might want to be looking for a declaration.

Thoughts?
-kmp