Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

Built-in expanders crash when used as identifier macros. #179

Closed Idorobots closed 1 week ago

Idorobots commented 8 months ago

Each expander should handle that case explicitly.

;; Spartan REPL. Type ;help for help.
2 | define
;; Error: car: contract violation
;;   expected: pair?
;;   given: 'define
Idorobots commented 8 months ago

This happens due to the assumption that these are used as applications:

(let ((node (ast-list-car expr)))
      (raise-compilation-error
       node
       "Bad `define` syntax, expected either an identifier and an expression or a function signature and a body to follow:"))