cbaggers / varjo

Lisp to GLSL Language Translator
BSD 2-Clause "Simplified" License
223 stars 23 forks source link

define-vari-struct must be toplevel #202

Closed mfiano closed 6 years ago

mfiano commented 6 years ago

I get a strange error when trying to wrap define-vari-struct in a let form. My use case was a macro that would generate a few structs inside a special binding.

Execution of a form compiled with errors.
Form:
  (VARJO.INTERNALS:V-DEF-GLSL-TEMPLATE-FUN MAKE-FOO2 (X) "FOO2(~a)" (:VEC3) FOO2 :V-PLACE-INDEX NIL)
Compile-time error:
  during macroexpansion of (VARJO.INTERNALS:V-DEF-GLSL-TEMPLATE-FUN MAKE-FOO2 (X) ...). Use *BREAK-ON-SIGNALS* to intercept.

 Varjo: Invalid return-type specifier in template-function FOO2
   [Condition of type SB-INT:COMPILED-PROGRAM-ERROR]
cbaggers commented 6 years ago

That is correct, define-vari-struct (and the other define* macros) are only to be used as top level forms. I'll update the documentation to reflect this. Thanks!