[plt-scheme] syntax and promises and possibly phases

From: Eli Barzilay (eli at barzilay.org)
Date: Sun May 18 14:04:49 EDT 2003

On May 18, Neil W. Van Dyke wrote:
> I want to define a syntax extension "rx" that will make an expensive
> computation "compile-rx" happen only once, so that:
> [...]

I used to have a macro that planted the regexp in the source:

  (defsyntax (regexp* stx)
    (syntax-case stx ()
      ((_ re)
       (let ((x (syntax-object->datum #'re)))
         (if (string? x)
           (quasisyntax/loc stx (#%datum . #,(regexp x)))
           (syntax/loc stx (regexp re)))))))

but that's not a good solution if you want to compile things...
Anyway, this was a problem I couldn't find any good solution for
(except some table solution but even that is tricky), but for the
specific case of regexps it all went away with the addition of
#rx"..." -- so if this is all you care about, no solution is needed.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.