Re: [racket-users] Correctly executing a source file from embedded Racket

2017-08-09 Thread Thomas Dickerson
On Thursday, July 27, 2017 at 9:01:11 AM UTC-4, Matthew Flatt wrote: > Declaring (as opposed to instantiating) a compiled module will normally > not raise an exception. Probably it's possible to construct a set of > embedded modules where there will be a declare-time error due to > conflicting or

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-27 Thread Matthew Flatt
At Wed, 26 Jul 2017 14:44:05 -0700 (PDT), Thomas Dickerson wrote: > Looking at this code specifically: > > | mz_jmp_buf * volatile save, fresh; > | save = scheme_current_thread->error_buf; > | scheme_current_thread->error_buf = > | > | if (scheme_setjmp(scheme_error_buf)) { > |/* There

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Thomas Dickerson
On Wednesday, July 26, 2017 at 11:09:48 AM UTC-4, Matthew Flatt wrote: > At Wed, 26 Jul 2017 07:54:32 -0700 (PDT), Thomas Dickerson wrote: > > One more thing: in terms of repeatedly executing scripts, does it make > > sense > > to set up and tear down the interpreter every time? Or just swap in

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Shu-Hung You
Hi Thomas, I tried following Matthew's suggestions to attach my-lang and use dynamic-require. Turns out that works pretty well! And then there's even no need to setup collection path since everything loads from compiled byte-code. https://gist.github.com/shhyou/aa2adaf7e1b7d548783cee352c3230a9

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Matthew Flatt
At Wed, 26 Jul 2017 07:54:32 -0700 (PDT), Thomas Dickerson wrote: > One more thing: in terms of repeatedly executing scripts, does it make sense > to set up and tear down the interpreter every time? Or just swap in a fresh > namespace? Between those two options, a fresh namespace is almost

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Thomas Dickerson
Thanks for the help, a couple more quick questions: On Wednesday, July 26, 2017 at 9:15:12 AM UTC-4, Matthew Flatt wrote: > You don't have to populate the top-level environment with > `racket/base`. You could instead use > > scheme_namespace_require(scheme_intern_symbol("my-lang")) > > where

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Matthew Flatt
At Tue, 25 Jul 2017 19:08:02 -0700 (PDT), Thomas Dickerson wrote: > On Tuesday, July 25, 2017 at 5:52:45 PM UTC-4, Shu-Hung You wrote:> > > As we can see, > `scheme_namespace_require(scheme_intern_symbol("racket/base"));` > > is actually missing from your setup program. This line requires racket

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-25 Thread Thomas Dickerson
On Tuesday, July 25, 2017 at 5:52:45 PM UTC-4, Shu-Hung You wrote:> > As we can see, > `scheme_namespace_require(scheme_intern_symbol("racket/base"));` > is actually missing from your setup program. This line requires racket > base and the usual #%app bindings. It's probably needed even if

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-25 Thread Shu-Hung You
Hi Thomas, I think the program is more of Racket programming setup rather than embedding Racket. When start a Racket program on our own, we have to setup the environment correctly. Here is my test program that can load an external program and the accompanying commands (also attached at the end).

[racket-users] Correctly executing a source file from embedded Racket

2017-07-25 Thread Thomas Dickerson
I've been working on building a DSL in Racket (as a #lang collection), and have reached the stage where it's functioning as expected and ready to be embedded in my application (which is written in C++). I have modified the `run` function from the embedding example here