Arc Forumnew | comments | leaders | submitlogin
1 point by Pauan 4458 days ago | link | parent

Isn't that the point of fexprs, though? That they can selectively eval their arguments? So couldn't the "quote the argument to suppress evaluation" just desugar into a fexpr that evals the argument? Something like this...

  (fn ('a b c . 'd)
    ...)
...would desugar (macro expand) into this...

  (fexpr (a b c . d) env
    (with (b (eval b env)
           c (eval c env))
      ...))
...assuming that env is a gensym to avoid clashes with variables in the function's body.

That is, a fn would either be wrapped or not depending on whether a quote appears in its argument list. I'm actually not fond of that, and would prefer to explicitly use fexprs when I want to not evaluate things, but... it is consistent with wart's already existing support for things.

Of course, that means that "fn" doesn't always create a function. It might potentially create either a fexpr or a function... not sure if you want that.