Arc Forumnew | comments | leaders | submitlogin
2 points by lisper 6110 days ago | link | parent

> The basic issue I would have with this is that variable capture like this happens maybe in 1/1000 uses of macros (thought it's already happened once to me, so I agree with your concern is valid)

Have you written 1000 macros? If not I'd say you underestimate the odds. Also, whatever the odds are, they just get worse as the size of the code base increases.

> However, your solution would make 100% of macro definitions ungainly, which is too high a cost, IMHO.

But macros only make up a small percentage of typical code, so this might still be OK.

> The best solution I can think of is:

Two problems with this:

1. Issuing those warnings is not easy. It requires a code walker. If you're going to go to that much trouble you might as well implement real hygienic macros.

2. (only-top foo) seems even more ungainly to me than ^foo.

I personally don't think the ^foo idea is the perfect solution, but given that PG doesn't like hygiene or Lisp-2 it seems like a good alternative. Better than burying your head in the sand and hoping the problem doesn't happen IMHO.