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

Re: module: How to specify indirect exports positively?



At Fri, 26 Apr 2002 14:16:30 +0200, Sebastian H Seidel wrote:
> (require
>  (rename A
>          (string->symbol 
>           (string-append 
>            (symbol->string (quote prefix.))
>            (symbol->string (quote var))))
>          var))
>        
> ==> require: bad syntax (internal name is not an identifier)

The macro that generates the `require' expression must put in place of
`(string->symbol ...)' the actual symbol, instead of an expression tat
produces the symbol.

Here's an example with `provide':

(module m mzscheme

  (define-syntax (provide-prefixless stx)
    (syntax-case stx ()
      [(_ prefix: name)
       (with-syntax ([prefix:name (string->symbol
                                   (format "~a~a"
                                           (syntax-e #'prefix:)
                                           (syntax-e #'name)))])
         (syntax (provide (rename prefix:name name))))]))
  
  (provide-prefixless demo: thing)
  
  (define demo:thing 5))


Matthew