Make macro hygiene easier to use.

PURPOSE:

The problem with Julia's current implementation of hygienic macros is
that it depends on the author of a macro to put calls to esc() in all
the right places.  Mistakes are hard to detect by testing because no
failure will occur until there is an accidental name clash.  Macros
are already hard to think about, no need to add unnecessary complications.

STRATEGY:

Deprecate esc() and make it not do anything.  Instead, quote marks all
symbols that appear directly in the quote, rather than being interpolated,
as hygienic.  Post-processing of the macro expansion will replace these
with the appropriate gensym, symbol, or module reference.

Make a distinction between hygienic and non-hygienic quote, because
quote is not only used by macros.  Only hygienic quote does the above.
Quote is hygienic when it is in the body of a macro or inside an
@hygienic annotation.  The output of hygienic quote will only work as
part of a macro expansion, it will not work with eval.

Unary : always behaves the same as quote.

As a special exception, quoting a single symbol never makes it
hygienic.  This seems to be the best compromise to maximize usability
without adding a new construct to reflect the fact that quoting a
single symbol is sometimes used to construct executable code and other
times used just to quote data.

Fix the few macros in the base code that were broken by these changes.

In the interest of simplicity, there are NO changes to the C code.

TESTING:

A clean build and make testall works on 32-bit Linux.

RISKS:

Did not test any packages that are not tested by make testall.
There could be complex macros out there that will stop working
because of these changes, analogous to @printf or @uv_write.

The distinction between hygienic and non-hygienic quote could be
confusing to users, although not as confusing as esc() was.

esc() is deprecated but not marked as such.

Calls to esc() are not removed from all over the source code.  That
could be cleaned up later.

Another problem is that the macro system has its own separate code
walker to decide where to insert gensyms for hygiene.  This creates
complexity and risk.  These changes are not fixing that, because to do
so would require changing much more of the Julia implementation to
allow symbols marked as hygienic to be used directly without
replacement by gensyms.  However, if we did those changes, eval()
would respect hygiene too and it would no longer be necessary to have
distinct hygienic and non-hygienic versions of quote.

PERFORMANCE IMPACT:

Using assoc instead of assq is slower, but it only affects the macro
expander.  There is also slightly more consing than there was before.
I doubt that the difference will be large enough for anyone to notice.

I did not give scm_to_julia() a special node type for hygienic symbol
markers.  I doubt that not optimizing that costs much performance.

PORTABILITY IMPACT:

None expected.

DOCUMENTATION IMPACT:

Remove documentation of esc() and all mention of it.

Document the distinction between hygienic and non-hygienic quote.

Document @hygiene.

Document that $:x is a convenient way to insert a non-hygienic x
into a hygienic quote.

I will see if I can provide a suggested rewrite of the metaprogramming
chapter to reflect these changes and make it easier to understand.

All macro examples should be checked to remove esc and see if anything
needs to be changed to keep them working.

FILES CHANGED:

src/julia-syntax.scm - New design for hygienic macros:
- (hygienic <symbol>) represents an occurrence of <symbol> in
  a hygienic quote.  It will be replaced with the appropriate
  gensym, symbol, or module reference when the macro is expanded.
- allow hygienic symbols as argument names, type parameter names,
  variables in pair-with-gensyms, and keyword argument names.  Keywords
  cannot be hygienic because the same symbol is both the name used
  by the caller and the variable bound in the callee (same as before).
- Add an argument to expand-backquote() to tell it whether the quote
  is hygienic or not.  If hygienic, add hygienic markers to all
  symbols that are variable names, but don't add them to Expr heads.
  Don't use copyast of inert in hygienic mode since we need to add
  hygienic markers to symbols.
- Add an argument to julia-expand-macros-() to tell it whether quotes
  are hygienic or not.  Support the @hygienic macro which uses the
  new with_hygiene Expr head.
- The hygienic renaming env has to be searched with assoc rather than
  assq because uniqueness of (hygienic <symbol>) objects cannot
  easily be preserved through julia_to_scm() and scm_to_julia().
- resolve-expansion-vars-() only replaces symbols marked as hygienic
  by wrapping in (hygienic <symbol>).  Plain symbols must have come
  from an interpolation of code supplied by a macro argument.

base/LineEdit.jl - The bindings introduced by @keymap are supposed
to be non-hygienic, make it so.

base/REPLCompletions.jl - There is no longer an escape Expr, remove
the check for it so the code will still work.

base/base.jl - Neuter esc() but for convenience don't remove it yet.
It's deprecated.

base/expr.jl - Add @hygienic macro which makes any quotes in its
body provide hygiene.  This means those quoted expressions will
only work as part of a macro expansion, they will not work with eval.

base/printf.jl - Add @hygienic to all subroutines of the @printf and
@sprintf macros so those macros will still be hygienic.  Fix code in
gen_d() to work around the fact that quote of just a symbol is no
longer hygienic; the replacement code is clearer to read anyway.
Fix @sprintf to use an explicit gensym to work around the same issue.

base/process.jl - @setup_stdio and @cleanup_stdio are supposed to
introduce non-hygienic bindings.

base/stream.jl - @uv_write is supposed to introduce a non-hygienic
binding of uvw.
Update documentation for new macro hygiene mechanism
Merge branch 'moon/hygienic-macros' of https://github.com/david-moon/julia into moon/hygienic-macros

Merged with git pull because git push asked me to do so.