Re: [racket-users] sharing a value between a DrRacket tool and a user program
On Tue, May 16, 2017 at 7:07 PM, 'John Clements' via Racket Userswrote: > >> On May 16, 2017, at 11:26 AM, Robby Findler >> wrote: >> >> If you have control of the language<%> class, then you can do that via >> the on-execute method. If you want to do that for all languages (which >> is probably not a good idea, but you could use this approach and limit >> it to a known set of languages), you could override the on-execute >> method of the rep<%> object (you can add a mixin). Use this to attach >> a module to the namespace of the user's program (e.g., >> #%my-private-state) that has minimal dependencies, and then some >> library you write would require that module and provide a nice >> interface, once it gets a hold of that minimal piece of state. > > Are there instances of language<%> that are used when the user has the > language level set to “use language declared in source” ? I’ve just spent a > few minutes looking over the DrRacket documentation for ‘read-language’, and > this documentation is suggesting to me that the language<%> interface is not > used for #lang-based languages, though I really can’t be sure. At a minimum, > I’m not seeing any references to language<%> in the section labeled "DrRacket > support for #lang-based Languages”. There is a specific one that's used in that case. Robby -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sharing a value between a DrRacket tool and a user program
> On May 16, 2017, at 11:26 AM, Robby Findler> wrote: > > If you have control of the language<%> class, then you can do that via > the on-execute method. If you want to do that for all languages (which > is probably not a good idea, but you could use this approach and limit > it to a known set of languages), you could override the on-execute > method of the rep<%> object (you can add a mixin). Use this to attach > a module to the namespace of the user's program (e.g., > #%my-private-state) that has minimal dependencies, and then some > library you write would require that module and provide a nice > interface, once it gets a hold of that minimal piece of state. Are there instances of language<%> that are used when the user has the language level set to “use language declared in source” ? I’ve just spent a few minutes looking over the DrRacket documentation for ‘read-language’, and this documentation is suggesting to me that the language<%> interface is not used for #lang-based languages, though I really can’t be sure. At a minimum, I’m not seeing any references to language<%> in the section labeled "DrRacket support for #lang-based Languages”. John -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sharing a value between a DrRacket tool and a user program
> On May 16, 2017, at 11:23 AM, Vincent St-Amour >wrote: > > John, Austin, > > You can use loggers for this. The `data` argument to `log-message` > allows payloads to be carried along with log messages. Just have the > user program log messages with a particular topic, and have the tool > listen on that topic. > > That's how the optimization coach (which is a DrRacket tool) gets info > from the the user program. Nice! Definitely would have taken us a long long time to think of something like that. Robby’s solution seems like the “right” solution, but this one sounds much easier to get right. Hmm…. John -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sharing a value between a DrRacket tool and a user program
If you have control of the language<%> class, then you can do that via the on-execute method. If you want to do that for all languages (which is probably not a good idea, but you could use this approach and limit it to a known set of languages), you could override the on-execute method of the rep<%> object (you can add a mixin). Use this to attach a module to the namespace of the user's program (e.g., #%my-private-state) that has minimal dependencies, and then some library you write would require that module and provide a nice interface, once it gets a hold of that minimal piece of state. Loggers, as Vincent suggests, might be better (or might be worse), I'm not sure. Robby On Tue, May 16, 2017 at 11:38 AM, 'John Clements' via Racket Userswrote: > Austin Sparks (cc:ed) and I are struggling with what I believe should be a > pretty simple problem; how can we share a value between a DrRacket tool and a > user’s program? Specifically, the value in question here is a channel > (probably an asynchronous channel) on which the user’s thread can place > musical-note-to-be-played values. > > The heavyweight way—I’m pretty confident this would work—is to provide our > own “run” button, allowing us to add existing module invocations to the > user’s namespace before the user’s module is expanded or invoked. However, > I’m thinking there’s … an easier way to do it? > > John > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sharing a value between a DrRacket tool and a user program
John, Austin, You can use loggers for this. The `data` argument to `log-message` allows payloads to be carried along with log messages. Just have the user program log messages with a particular topic, and have the tool listen on that topic. That's how the optimization coach (which is a DrRacket tool) gets info from the the user program. Vincent On Tue, 16 May 2017 11:38:32 -0500, 'John Clements' via Racket Users wrote: > > Austin Sparks (cc:ed) and I are struggling with what I believe should be a > pretty simple problem; how can we share a value between a DrRacket tool and a > user’s program? Specifically, the value in question here is a channel > (probably an asynchronous channel) on which the user’s thread can place > musical-note-to-be-played values. > > The heavyweight way―I’m pretty confident this would work―is to provide our > own “run” button, allowing us to add existing module invocations to the > user’s namespace before the user’s module is expanded or invoked. However, > I’m thinking there’s … an easier way to do it? > > John > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] sharing a value between a DrRacket tool and a user program
Austin Sparks (cc:ed) and I are struggling with what I believe should be a pretty simple problem; how can we share a value between a DrRacket tool and a user’s program? Specifically, the value in question here is a channel (probably an asynchronous channel) on which the user’s thread can place musical-note-to-be-played values. The heavyweight way—I’m pretty confident this would work—is to provide our own “run” button, allowing us to add existing module invocations to the user’s namespace before the user’s module is expanded or invoked. However, I’m thinking there’s … an easier way to do it? John -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.