noprompt / meander

Tools for transparent data transformation
MIT License
921 stars 54 forks source link

Recursive defsyntax expands infinitely #93

Open noprompt opened 4 years ago

noprompt commented 4 years ago

Consider

(m/defsyntax static
  ([]
   `(m/or ('quote _)
          (m/pred number?)
          (m/pred keyword?)
          [(static) ...])))

This syntax extension will be expanded to point of a StackOverflowError, however, it should be possible to avoid this. Since m/with allows for recursive definitions we should be able to rewrite the body of the syntax extension in terms of m/with such that the recursive semantics are preserved and without causing a StackOverflowError at compile time.