Re: [racket-dev] define-require-syntax issue

2014-10-22 Thread Jay McCarthy
A tiny note for Google... the source location information isn't part of hygiene, it's like an orthogonal axis. When a form like (syntax ) is used, it creates a new piece of syntax where the origin is that particular file/line. When you use syntax/loc, you create a new syntax object but you cop

Re: [racket-dev] define-require-syntax issue

2014-10-22 Thread Dan Liebgold
That makes sense. It turns out I need replace-context *and* quasisyntax/loc (and back to absolute paths): (define-require-syntax (gamelib stx) (syntax-case stx () ((_ name) (replace-context stx (quasisyntax/loc stx (file #,(format "~a/some/path/~a.dc" (current-directory) (syntax->datum #'name

Re: [racket-dev] define-require-syntax issue

2014-10-22 Thread Jay McCarthy
If you have (require X) then the identifiers imported from X get the lexical context of X. (Slight note: In something like (rename-in X [A B]) then they get the context of A.) If a macro made X, then the lexical context is equivalent to #f, because every macro application gets a fresh lexical cont

Re: [racket-dev] define-require-syntax issue

2014-10-22 Thread Dan Liebgold
So, yeah... that appears to work! I use replace-context to give the resulting require syntax output the context of the original argument. Here's what the change looks like, with my old way commented (unrelated note: path is actually relative): (define-require-syntax (gamelib stx) (syntax-case s

Re: [racket-dev] define-require-syntax issue

2014-10-22 Thread Jay McCarthy
#lang racket/base ;; This module has a binding and an effect, so we can see that it was ;; required even when we can't get to it. (module example racket/base (define x 1) (printf "I'm running here\n") (provide x)) ;; If you comment this in, you'll see the "normal" way to require it. #; (le

[racket-dev] define-require-syntax issue

2014-10-21 Thread Dan Liebgold
If I do a (require (file )) in a module, the provided stuff gets imported properly. If I do a special require form that uses define-require-syntax to generate an identical (file <...>) the specified module gets evaluated -- but (seemingly) nothing gets imported. Is there something special the def