Arc Forumnew | comments | leaders | submitlogin
1 point by ylando 3322 days ago | link | parent

I have another idea:

  We can combine the next macro with the ":" shortcut
  (mac c ((obj (func . args)))
    '(call ,obj ,func ,@args)))
  (= document!body!innerHTML 
    ((c:document:getElementById "foo") value))
  It will translate to:
  (= ((document 'body) 'innerHTML)
     ((call document getElementById "foo") value))

1 point by evanrmurphy 3322 days ago | link

Interesting, but where is call defined?

Also a nitpick: your c macro needs quasiquote and has too many parens:

  (mac c (obj (func . args))
    `(call ,obj ,func ,@args)))
I'm not quite sure how the args in that macro are supposed to work. Is it somehow taking advantage of destructuring bind, or why is it (obj (func . args)) instead of just (obj func . args)

Thanks for the suggestion. Looking forward to hearing you elaborate.


1 point by ylando 3321 days ago | link

It supposes to be:

  (mac c (obj (func . args))
     `(call ,obj ,func ,@args))
Call is a macro for calling functions in object system. If you don't have one you can use something like this:

  (mac c (obj (func . args))
     `(,func ,obj ,@args))
It use destructoring bind of the compose functions:

  (c:obj!sub-obj:func arg1 arg2)
Translate into:

  (c ((obj 'sub-obj) (func arg1 arg2)))