Arc Forumnew | comments | leaders | submitlogin
1 point by shader 3437 days ago | link | parent

The and is required to make sure that a type was provided, otherwise it will always fail the type check. Also, if you leave n out of the and clause, it will still pass if the required type is sym. Maybe that should be fixed.

1 point by Pauan 3437 days ago | link

Hm... yes, you're right. Odd, I remember it working fine when I tested it earlier. This should work correctly:

  (mac require (n (o t))
    `(if (no ,n)                  (err:string "parameter " ',n " is required")
         (and ,t (no:isa ,n ,t))  (err:string "parameter " ',n " must be of type " ,t)))