guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please explain different macros


From: Rob Browning
Subject: Re: Please explain different macros
Date: 25 Apr 2001 15:32:01 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Keith Wright <address@hidden> writes:

> I enthusiastically recommend using only Define-syntax or the locally
> scoped analogs Let-syntax or Letrec-syntax, unless they won't work
> (and they work more often than most people think at first thought).

While people are on the topic (and especially since we're talking
about documentation), I recently realized/verified with others on
guile-devel that guile's gentemp/gensym implementation does *not*
produce safe symbols by default, so in cases where temp symbols are
needed in a macro expansion, it looks like it would be very difficult
to write a correct expansion.

In common-lisp, for example, gensym produces unreadable symbols (that
I presume are globally unique), so there can be no name clashes, but
guile does not.

  guile> (gensym)
  g0
  guile> (gensym)
  g1
  guile> (define g2 7)
  guile> (gensym)     
  g2
  guile> (eq? (gensym) 'g3)
  #t
  guile> 

In these situations, define-syntax (and friends) would avoid the
problem.

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

[Prev in Thread] Current Thread [Next in Thread]