This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

compiling syntax and macro


Hello,

I started trying to compile macros and syntaxes for my VM.
Guile does evaluate like this:

  guile> (define foo let)
  guile> (foo ((a 1)) a)
  1

So syntax is an object rather than a name.  This is conceptually clean
and I like it, but thinking of how to compile these expressions, I
realized that there is no way to statically know what name is associated
with what macro.  For example,

  (define foo (if (> (current-time) 100000) let let*))

  (foo ((a 1) (b a)) b)

I can't compile this.  It is possible to generate a bytecode that
dynamically evaluates these expressions and works correctly, but it will
be less efficient and more complicated than statically analyzed version.

So what about defining macros only by using define-syntax and evaluating
them at compile time?  I suppose R5RS doesn't require the above behavior
Guile does now.

Thanks,
Keisuke Nishida

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]