Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 4337 days ago | link | parent

Ah, I figured out what you were getting at:

  wart> (def helper(a b) `(cons ,a ,b))
  wart> (mac foo(a b) (helper a b))
  wart> (foo 1 '(2 3))
  (1 2 3)
  wart> (foo @'(1 (2 3)))
  008eval.cc:79 calling macros with splice can have subtle effects (http://arclanguage.org/item?id=15659)
  005types.cc:263 can't coerce number 2 to function
Eep! You're right, this is a fairly common use case.

The good news is that wart's warning system has held up. If it can't handle it it throws that warning.



1 point by akkartik 4325 days ago | link

macros-calling-functions-generating-backquoted-lists now works!

The cost is a special variant of eval to call inside macros: http://github.com/akkartik/wart/commit/e3124e9559#diff-3

I still emit the warning, because examples like this fail:

  wart> (def helper(a b) `(cons ,a ,b))
  wart> (mac foo args (helper @args))
  wart> (foo @'(1 (2 3)))
  008eval.cc:79 calling macros with splice can have subtle effects (http://arclanguage.org/item?id=15659)
  005types.cc:263 can't coerce number 2 to function

-----