[plt-scheme] syntax/loc and this-expression-source-directory

From: Dave Herman (dherman at ccs.neu.edu)
Date: Sun Apr 6 14:36:33 EDT 2008

My PLaneT package test.plt has a macro that extracts the directory of 
the file containing a given expression:

   (require (lib "etc.ss"))
   (define-syntax (source-directory-of-expression stx)
     (syntax-case stx ()
       [(_ context)
        (syntax/loc #'context

This used to work but it isn't working in 3.99. That is, the following 

   #lang scheme/base
   (require (planet "test.ss" ("dherman" "test.plt" 1)))
   (printf "~a~n" (source-directory-of-expression foo))

prints the PLaneT directory where test.ss lives, rather than the 
directory of the client module.

I checked and the `syntax/loc' expression does have the correct 
syntax-source information, so I imagine it must be some change to the 
behavior of `this-expression-source-directory'? Is there a better way to 
implement this macro?


Posted on the users mailing list.