Re: [racket-users] using `define-runtime-path` inside macros

2018-11-21 Thread Alex Harsanyi
On Friday, August 31, 2018 at 11:11:29 PM UTC+8, Matthew Butterick wrote: > > > On Aug 31, 2018, at 3:25 AM, Alex Harsanyi > wrote: > > Is there a way to write this macro such that the runtime path is defined > relative to the location of the file that uses `define-sql-statement`? > > > One

Re: [racket-users] using `define-runtime-path` inside macros

2018-08-31 Thread Matthew Butterick
> On Aug 31, 2018, at 4:14 PM, Alex Harsanyi wrote: > > Thanks for this solution, it works. While I understand what is being done, I > do not understand why it is necessary >From the docs: "The path is normally computed by taking a relative path result from expr and adding it to a path

Re: [racket-users] using `define-runtime-path` inside macros

2018-08-31 Thread Alex Harsanyi
On Friday, August 31, 2018 at 11:11:29 PM UTC+8, Matthew Butterick wrote: > > > On Aug 31, 2018, at 3:25 AM, Alex Harsanyi > wrote: > > Is there a way to write this macro such that the runtime path is defined > relative to the location of the file that uses `define-sql-statement`? > > > One

Re: [racket-users] using `define-runtime-path` inside macros

2018-08-31 Thread Matthias Felleisen
#lang racket (require racket/runtime-path db (for-syntax racket/base syntax/parse)) (define-syntax (define-sql-statement stx) (syntax-parse stx [(_ name #;path) (define location (syntax-source #'name)) (define-values (path file _) (split-path location)) (with-syntax ([path

Re: [racket-users] using `define-runtime-path` inside macros

2018-08-31 Thread Matthew Butterick
> On Aug 31, 2018, at 3:25 AM, Alex Harsanyi wrote: > > Is there a way to write this macro such that the runtime path is defined > relative to the location of the file that uses `define-sql-statement`? One option, using `syntax-source` to get the starting directory: #lang racket (require