Re: [racket-users] Re: find-expr: find a corresponding expression in the definition window

2020-08-31 Thread Robby Findler
That's a nice idea! The code that calls current-print can check to see if the function accepts a specific keyword parameter and, if it does, supply it with a srcloc. Robby On Mon, Aug 31, 2020 at 2:38 PM Greg Hendershott wrote: > I might be misunderstanding and the following isn't some

Re: [racket-users] abstraction suggestion?

2020-08-31 Thread Philip McGrath
In addition (or instead, if this is good enough and less painful), you could use a compile-time helper function like: (define-for-syntax (make-mb+ti namespaces-stx lang-print-names-stx) (define-syntax-class to-run #:attributes (parsed) #:literals (TEST)

[racket-users] abstraction suggestion?

2020-08-31 Thread Shriram Krishnamurthi
I'm having some trouble abstracting over this code. Any suggestions? I have numerous files that follow this boilerplate: #lang racket (require ) (provide (rename-out [mod-begin #%module-begin] [ti#%top-interaction])) (define-values (namespaces lang-print-names)

Re: [racket-users] abstraction suggestion?

2020-08-31 Thread Hendrik Boom
On Mon, Aug 31, 2020 at 10:06:42AM -0700, Shriram Krishnamurthi wrote: > I'm having some trouble abstracting over this code. Any suggestions? > > I have numerous files that follow this boilerplate: > > #lang racket > > (require ) > > (provide (rename-out [mod-begin #%module-begin] >

Re: [racket-users] abstraction suggestion?

2020-08-31 Thread Philip McGrath
There might be a better way, but I'd probably make a language for writing this kind of module, in the spirit of `#lang syntax/module-reader`, where its `#%module-begin` would expect the module body to be ``, similar to the way that the body of `(module reader syntax/module-reader

[racket-users] Re: find-expr: find a corresponding expression in the definition window

2020-08-31 Thread Greg Hendershott
I might be misunderstanding and the following isn't some fully-thought-out proposal, but: IIUC both #%module-begin and read-eval-print-loop use current-print. What if current-print accepted a new, optional srcloc parameter? And the default #%module-begin were changed to supply this? That way,